state-management-riverpod
Installation
SKILL.md
State management (Riverpod)
State and dependency injection are one mechanism: Riverpod 3.x. Each feature has one Notifier/AsyncNotifier/StreamNotifier ViewModel that exposes an immutable state value; dumb ConsumerWidgets read it. Widgets hold only ephemeral UI state; every durable mutation routes through one repository (the single write path). This skill covers the state-agnostic core first, then the Riverpod "how", then a Provider/ChangeNotifier appendix for the official Flutter-guide stack.
Read the reference for the task at hand:
references/ownership-and-lifecycle.md— the ownership table (which provider shape), family/autoDispose/onDispose rules, composition-root DI.references/reads-and-side-effects.md— watch vs read vs listen vs select, the stale-closure hole,voidaction methods,ref.mounted/BuildContextguards.references/riverpod3-api-and-testing.md— Riverpod 3.x API shifts (legacy moves,overrideWithValue, retry,ProviderContainer.test), what 2023 tutorials get wrong, and testing seams.
Run scripts/ban-legacy-providers.sh before a PR.
Non-negotiable rules
These hold regardless of the state library.