dart-async-correctnesslisted
Install: claude install-skill antgrid-ai/antgrid
# Dart Async Correctness
Async bugs in Dart are quiet. A missing `await`, a `BuildContext` used after a gap, a `.then()` that drops an error — none of these crash loudly or trip `flutter analyze` under this project's `flutter_lints` config. They surface later as leaked widgets, "setState after dispose", swallowed exceptions, UI flicker, or latency nobody can explain. So the discipline has to come from how the code is written, not from a tool catching it after the fact.
This project (`app/`, `packages/antgrid_relay_client/`, `packages/antgrid_eval_client/`) already uses the right idioms: `unawaited(...)` for deliberate fire-and-forget, `mounted` / `context.mounted` guards after awaits, `Future.wait([...])` for concurrency, and Riverpod `AsyncValue` instead of `FutureBuilder`. Match those. The patterns below explain *why* each one matters so you can apply the judgment, not just the rule.
## The one question to ask every time
**"This call returns a Future — what happens to it?"** Every Future has exactly three honest destinies:
1. **Awaited** — you need its result or its completion before continuing.
2. **`unawaited(...)`** — you deliberately don't wait, and you've made sure its errors can't vanish.
3. **Returned** — you hand it to your caller to await.
A Future that is none of these (a bare `doThing();` where `doThing` is async) is a bug in waiting: its errors become unhandled, its ordering is undefined, and the analyzer won't warn you. If you find yourself writing one, s