riverpod

Implements Riverpod state management patterns for Flutter and Dart applications.

1|Updated Aug 14, 2026
One-click install
npx skills add https://github.com/sohampawar1866/zeromile-go --skill riverpod-sohampawar1866
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: riverpod
Source: https://github.com/sohampawar1866/zeromile-go/tree/main/.agents/skills/riverpod
Command: npx skills add https://github.com/sohampawar1866/zeromile-go --skill riverpod-sohampawar1866

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing state in Flutter apps often leads to memory leaks, incorrect provider usage, and untestable code. This Skill provides correct patterns for defining providers, handling disposal, passing arguments, and testing with Riverpod. ## Core Features & Use Cases - Provider Definition & Setup: Guides correct use of ProviderScope, codegen providers, FutureProvider, and Notifier classes with riverpod_lint enforcement. - Lifecycle & Disposal Management: Covers autoDispose, keepAlive, ref.onDispose, and invalidation to prevent memory leaks in parameterized providers. - Testing Support: Shows how to override dependencies with ProviderContainer and ProviderScope for isolated unit and widget tests. - Use Case: When building a Flutter todo app, use this Skill to define a TodosNotifier, pass a todo ID via a family provider, and write widget tests with a fake repository override. ## Quick Start Use the riverpod skill to set up a FutureProvider with autoDispose that fetches a todo by ID and write a widget test for it.

Frequently Asked Questions about riverpod

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

FAQPage Schema
How do I pass arguments to a Riverpod provider?

Use family providers by adding parameters to your provider function, such as todoProvider('some-id'). Enable autoDispose to prevent memory leaks, and use Dart 3 records or codegen for multiple parameters since they override equality.

How do I test Riverpod providers in Flutter?

Create a new ProviderContainer with overrides injecting fake repositories for unit tests, or wrap widgets in ProviderScope with overrides for widget tests. Never share containers between tests, and use container.listen for autoDispose providers.

What is the difference between ref.watch and ref.read in Riverpod?

ref.watch reactively listens and rebuilds when values change, and should only be used during the build phase. ref.read provides one-time access and is used in callbacks and Notifier methods, never in build.

When should I use autoDispose in Riverpod?

With code generation, state is destroyed by default when no longer listened to; opt out with keepAlive: true. Without codegen, state persists by default, so add .autoDispose, especially for parameterized family providers.

Why does my Riverpod family provider leak memory?

Family providers create a new state instance per parameter, so without autoDispose they accumulate indefinitely. Also avoid passing plain Lists or Maps as parameters since they lack equality overrides, causing duplicate provider instances.