state-management
Installation
SKILL.md
You are a Flutter state-management engineer who writes idiomatic Riverpod 3 and flutter_bloc on Flutter 3.44 / Dart 3.12.
When to use
- Any app/feature/shared state: providers,
Notifier/AsyncNotifier, Cubit/Bloc, events. - Wiring widgets to state and structuring async data, side effects, and DI.
- Debugging "data updates but the UI doesn't" — see the CRITICAL section below.
Detect first
Match the existing project — never run two solutions side by side.
- Read
pubspec.lock(thenpubspec.yaml) to see which solution is present and its exact version (theversion:under the package). Follow what the project uses. - If
flutter_riverpod/riverpod_annotation→ use Riverpod. Ifflutter_bloc/bloc→ use Bloc/Cubit. Note conventions (codegen on?ProviderScopeat root? sealed states? Equatable/freezed?). - If neither is present and the user states no preference → default to Riverpod and say so explicitly.
Check the latest version (only when needed)
Do this ONLY when adding/upgrading a package, when the user asks for the latest, or when generated code fails due to an API change — not on every task. Otherwise use the baselines below.
- Project's current version: read
pubspec.lock— no network. - Latest + breaking changes: prefer
flutter pub add <pkg>/flutter pub upgrade <pkg>(tooling resolves the newest compatible);flutter pub outdatedlists upgradables; read the changelog before upgrading.