Use when working with Flutter Riverpod state management. Covers providers, consumers, refs, containers, overrides, async state, code generation, testing, and safe defaults.
64
78%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./content/flutter/skills/state-management/riverpod/SKILL.mdUse this skill when building Flutter state management with riverpod and flutter_riverpod.
Provider for read-only values and dependency wiring.StateProvider for small mutable state.FutureProvider for one-shot async loading.StreamProvider for reactive streams.Notifier or AsyncNotifier for feature state that needs mutation methods.autoDispose for short-lived state.family when provider output depends on an argument.flutter_riverpod in Flutter apps.flutter_riverpod, you usually do not add riverpod separately because the Flutter package brings it in transitively.riverpod 3.2.1, flutter_riverpod 3.3.1).Choose Riverpod when:
Choose a different pattern when:
For Dart-only code:
riverpodFor Flutter UI code:
flutter_riverpodProviderScopeConsumerWidget, Consumer, or ConsumerStatefulWidget where ref is neededIf code generation is used:
riverpod_annotationriverpod_generatorbuild_runnerPrefer this structure:
ref.watchref.readKeep providers small and composable. Keep state immutable unless the provider type is specifically meant for mutation. Keep feature logic in providers or notifiers, not in widgets.
autoDispose for short-lived screens and transient queries.ref.keepAlive() only when you want cached state to survive temporarily.ProviderContainer when finished.Use ConsumerWidget when the whole widget depends on providers.
Use Consumer when only a small subtree needs access to ref.
Use ConsumerStatefulWidget when you need widget lifecycle plus ref.
Use select to reduce rebuilds.
Use ProviderListener or ref.listen for side effects.
ProviderContainer.AsyncValue states directly for async providers.ref.watch inside callbacks; use ref.read there.ProviderScope at the app root.StateProvider for large feature state.select.FutureProvider or AsyncNotifier fits.When writing code or advising on design:
ProviderScope is requiredautoDispose or cachedfamily is needed for argumentsriverpod_annotation / riverpod_generator versions from the same 3.x release lineProviderScope = app root setupref.watch = rebuild on changeref.read = imperative accessselect = narrower rebuildsautoDispose = short-lived statefamily = parameterized providerProviderContainer = test/headless container67dcbeb
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.