# Flutter

> Build reliable Flutter apps avoiding state loss, widget rebuild traps, and async pitfalls. Use when this capability is needed.

- Skill: `tomevault-io/flutter-2` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/flutter-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/flutter-2/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/flutter-2

---


## 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

---
> Source: [clawic/skills](https://github.com/clawic/skills) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-06-16 -->

