返回 Skill 列表
extension
分类: 开发与工程无需 API Key

Flutter

使用 Flutter 组件、状态管理和平台集成构建高性能跨平台应用。

person作者: ivangdavilahubclawhub

Quick Reference

| Topic | File | |-------|------| | setState, state loss, keys | state.md | | build method, context, GlobalKey | widgets.md | | FutureBuilder, dispose, mounted | async.md | | Context after pop, deep linking | navigation.md | | const, rebuilds, performance | performance.md | | Platform channels, null safety | platform.md |

Critical Rules

  • setState after dispose — check mounted before calling, crashes otherwise
  • Key missing on list items — reordering breaks state, always use keys
  • FutureBuilder rebuilds on parent rebuild — triggers future again, cache the Future
  • BuildContext after async gap — context may be invalid, check mounted first
  • const constructor — prevents rebuilds, use for static widgets
  • StatefulWidget recreated — key change or parent rebuild creates new state
  • GlobalKey expensive — don't use just to access state, pass callbacks instead
  • dispose incomplete — cancel timers, subscriptions, controllers
  • Navigator.pop with result — returns Future, don't ignore errors
  • ScrollController not disposed — memory leak
  • Image caching — use cached_network_image, default doesn't persist
  • PlatformException not caught — platform channel calls can throw