content/flutter/skills/state-management/riverpod/SKILL.md
Use when working with Flutter Riverpod state management. Covers providers, consumers, refs, containers, overrides, async state, code generation, testing, and safe defaults.
npx skillsauth add andrewyng/context-hub riverpodInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use 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 containertesting
Use when working with Flutter Bloc/Cubit state management. Covers when to choose Bloc vs Cubit, how to use bloc and flutter_bloc together, lifecycle, testing, and safe defaults.
development
Build production-ready Tavily integrations with best practices for web search, content extraction, crawling, and research in agentic workflows, RAG systems, and autonomous agents
tools
Guide for AI agents to source electronic components using parts-mcp — tool sequencing, decision patterns, and multi-step workflows
tools
Common login automation patterns for web apps using Playwright