flutter-state-management · git:20261120.76a1b83 · 2026-11-20 · sha256 e9cec0ba76d0a452
flutter-state-management git:20261120.76a1b83A
Immutable. This exact content never changes and is served at /api/v1/blob/e9cec0ba76d0a452.
No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_pprw33uqeh6e3imi/e9cec0ba76d0a45235d346b23bb81d5f7c58c86fe1e87735da6f6f24653802fa.json
Then /plugin install flutter-state-management@markdownregistry-pprw33uqeh6e3imi in Claude Code. It installs this exact version, the one graded A here, pinned to the commit it was graded at, and leaves it there.
--- name: flutter-state-management description: Chooses between Riverpod and Bloc for a Flutter feature, implements it cleanly and covers the logic and widgets with tests. --- # Flutter state management Follow the project's existing choice. Introduce a second state library only if the user asks. ## Steps 1. Read `pubspec.yaml` and two existing features. Note which of `flutter_riverpod`, `flutter_bloc`, `provider` is in use and how files are laid out. 2. If nothing is in use, choose by need. Riverpod fits derived and cached async data, dependency injection and many small independent states. Bloc fits event-driven flows with strict transitions, such as multi-step forms, auth and payments, where an event log is valuable. Say which you chose and why in two sentences. 3. Model state as an immutable type with explicit cases: initial, loading, data, failure. Use a sealed class or freezed. Never a bag of nullable fields plus a boolean `isLoading`. 4. Riverpod: use `AsyncNotifier` or `Notifier`, read with `ref.watch` in `build`, use `ref.read` only in callbacks, and use `select` to narrow rebuilds. Bloc: one event class per user intent, one `on<Event>` handler each, emit only from handlers, and close subscriptions in `close()`. 5. Keep widgets thin. They render state and send events or call notifier methods. No repository calls, no `BuildContext` inside logic. 6. Tests: unit test the notifier with a `ProviderContainer` and overrides, or the bloc with `bloc_test`. Add widget tests that pump each state and check the visible result. 7. Run `dart format`, `flutter analyze` and `flutter test`. ## Rules - Dispose controllers and cancel streams. - Never call `notifyListeners` or emit after dispose. - No global mutable singletons for state. ## Report The library chosen and the reason, files added or changed, and test results.