riverpod-state-management

Implement Riverpod state management in Flutter with providers and code generation.

1|Updated Oct 13, 2025
One-click install
npx skills add https://github.com/RIMTHAN-LAB/rimthan-plugins --skill riverpod-state-management
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: riverpod-state-management
Source: https://github.com/RIMTHAN-LAB/rimthan-plugins/tree/main/flutter/skills/riverpod-state-management
Command: npx skills add https://github.com/RIMTHAN-LAB/rimthan-plugins --skill riverpod-state-management

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps Flutter developers implement robust state management using Riverpod, including providers, dependency injection, code generation, async data handling, and testing patterns.

Core Features & Use Cases

  • Provider Types Overview: Immutable, StateProvider, FutureProvider, StreamProvider, StateNotifier, Notifier, AsyncNotifier.
  • Code Generation: Use riverpod_generator and riverpod_annotation for type-safe providers.
  • Testing & Debugging: Test providers and automations.
  • Migration & Hooks: Migrate from Provider; use hooks_riverpod for widget composition.

Quick Start

Initialize the app with ProviderScope at the root; implement a simple counter with StateProvider and a FutureProvider for data loading; expand with a Notifier/AsyncNotifier for complex state management.

Frequently Asked Questions about riverpod-state-management

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up state management in Flutter with Riverpod?

State management with Riverpod starts by wrapping your app with ProviderScope at the root. Then define providers using Provider, StateProvider, or FutureProvider depending on your data type, and access them in widgets via ConsumerWidget or useProvider hooks to rebuild on state changes.

What's the difference between Provider, StateProvider, and FutureProvider in Riverpod?

Provider holds immutable computed values; StateProvider manages mutable state you can modify directly; FutureProvider handles async data that resolves to a single value. Choose based on whether your data is read-only, mutable, or asynchronous.

Do I need code generation for Riverpod providers?

Code generation with riverpod_generator and riverpod_annotation is optional but recommended for type safety and reducing boilerplate. Run build_runner to generate type-safe provider code from annotations, preventing runtime errors.

How do I migrate from Provider package to Riverpod?

Migrate by replacing Provider widgets with ProviderScope, converting ChangeNotifier classes to Notifier or AsyncNotifier, and updating widget consumption to ConsumerWidget. Riverpod's dependency injection and code generation eliminate Provider's context-dependency limitations.

Can I use hooks_riverpod with Riverpod for widget composition?

Yes, hooks_riverpod integrates with Riverpod to let you use React-style hooks like useProvider in StatelessWidget functions. This simplifies state access in widgets without requiring ConsumerWidget, making composition more flexible.

How do I handle async data and errors with Riverpod in Flutter?

Use FutureProvider or AsyncNotifier to fetch data asynchronously and expose loading, error, and data states. Access the AsyncValue result in widgets to handle each state, and Riverpod caches results and manages dependencies automatically.