1---2name: dart3description: Skill: Dart for Flutter4---56# Skill: Dart for Flutter78## Purpose9This hub routes Dart-language topics that strongly impact Flutter apps: async correctness, null safety, immutability, extensions, isolates, and error modeling.1011## When to use12- You see async lifecycle bugs ("setState after dispose", stale responses, retries).13- You need safer APIs (null safety, typed errors) or predictable data structures.14- You want to move CPU work off the UI thread.1516## When NOT to use17- Your issue is a layout or rendering problem; start at [flutter_core/SKILL.md](../flutter_core/SKILL.md).18- Your issue is state management architecture; start at [state/SKILL.md](../state/SKILL.md).1920## Core concepts21- **Event loop**: Futures and microtasks determine ordering.22- **Null safety**: types are contracts; prefer modeling over `!`.23- **Immutability**: predictable state transitions and cheaper tests.24- **Isolates**: concurrency by message passing, not shared memory.2526## Recommended patterns27- Model failures as data (sealed failures) where UX/testing benefits.28- Prefer immutable models and copy-on-write updates.29- Cancel or ignore stale async work when the owner is disposed.30- Offload CPU-heavy work (JSON decode, sorting large lists) to an isolate.3132## Minimal example3334How to pick a topic:3536```text37- Async ordering/cancellation -> async.md38- Null crashes / optional fields -> null_safety.md39- Defensive list/map updates -> collections.md40- Reusable helpers -> extensions.md41- CPU work off UI thread -> isolates.md42- Typed failures -> error_handling.md43```4445## Edge cases46- Async work may complete after navigation; you must check ownership.47- JSON fields are often missing/nullable; model them explicitly.4849## Common mistakes50- Using `dynamic` to "get it working" and losing type safety.51- Treating all failures as exceptions instead of modeling expected errors.5253## Testing strategy54- Unit test pure Dart logic and error modeling.55- Use fake clocks/clients to make async tests deterministic.5657## Related skills58- [Flutter lifecycle](../flutter_core/widget_lifecycle.md)59- [Async state modeling](../state/shared/async_state.md)60- [Error modeling](../architecture/error_modeling.md)
Run npx skillmds@latest add melsaeed276/dart in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Skill: Dart for Flutter It is listed under DevOps & Infra on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Melsaeed276 (@melsaeed276) published this skill. Their other Agent Skills are listed on their SkillMD profile.