AI-consumed reference. Optimized for Claude to read during execution. Human-readable explanation: see docs/architecture/HIERARCHICAL_PLANNING.md or docs/getting-started/ depending on topic.
Flutter Expert — Gotchas & Decisions
Use Context7 for full Flutter/Dart docs.
Key Decisions
decisions[4]{choice,use_when}:
Riverpod vs BLoC,"Riverpod: simpler apps + compile-safe. BLoC: complex event-driven + team conventions"
StatelessWidget vs StatefulWidget,"Stateless default. Stateful only for local mutable state (animations/controllers)"
go_router vs Navigator,"go_router for declarative deep linking. Navigator for simple stack-based"
Feature-first vs Layer-first,"Feature-first: lib/features/auth/{data|domain|presentation}"
Gotchas
- Always
constconstructors for immutable widgets — huge rebuild savings BuildContextused after async gap → widget may be unmounted. CheckmountedfirstListView.buildernotListView(children:[...])for long lists — avoids building all itemssealed classfor Result pattern (Success/Failure) — exhaustive switch- Riverpod:
ref.watchin build,ref.readin callbacks. Neverref.watchin callbacks - BLoC: never emit state after
close()— checkisClosedin async operations - Platform channels: always handle
MissingPluginExceptionfor web/desktop TextEditingControllerandAnimationControllerMUST be disposed indispose()MediaQuery.of(context)causes rebuilds — useMediaQuery.sizeOf(context)for just size