riverpod-family

Map parameters to isolated states with Riverpod family providers.

Updated Mar 28, 2026
One-click install
npx skills add https://github.com/masssi164/weave --skill riverpod-family-masssi164
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: riverpod-family
Source: https://github.com/masssi164/weave/tree/main/.agent/skills/riverpod-family
Command: npx skills add https://github.com/masssi164/weave --skill riverpod-family-masssi164

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Riverpod family patterns solve the challenge of managing multiple independent piecewise states produced by a single provider. It allows creating a parameterized provider where each distinct parameter maps to its own isolated state, avoiding global caches and manual bookkeeping.

Core Features & Use Cases

  • Parameterized state per ID or key via .family and its Async variants.
  • AutoDispose support to avoid unbounded caches and memory leaks.
  • Test-time overrides for parameterized providers to facilitate deterministic testing.
  • Use Case: fetch a user by ID and cache results per ID while sharing common logic.

Quick Start

Create a parameterized provider using .family and watch it with an ID to see isolated state per parameter.

Frequently Asked Questions about riverpod-family

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

FAQPage Schema
How do I manage parameterized state in Riverpod for fetching data by ID?

Parameterized state in Riverpod is managed using .family providers to map each distinct parameter, like an ID, to its own isolated state. This avoids global caches and manual bookkeeping while fetching data by ID.

How does the Riverpod family mechanism work for per-parameter caching?

The Riverpod family mechanism works by constructing providers that accept parameters, ensuring each parameter has proper equality semantics. This maps each distinct parameter to its own isolated state for accurate per-parameter caching.

How do I use autoDispose with Riverpod family providers to prevent memory leaks?

To prevent memory leaks with Riverpod family providers, use autoDispose support. This avoids unbounded caches and memory leaks by automatically disposing of the state for a specific parameter when it is no longer in use.

Can I use test overrides for parameterized Riverpod providers in Flutter?

Yes, you can use test-time overrides for parameterized Riverpod providers in Flutter. This facilitates deterministic testing by allowing you to mock or replace the family provider outputs during test execution.

What is the best way to handle pagination with Riverpod in Dart?

The best way to handle pagination with Riverpod in Dart is using .family variants. By passing page parameters to a family provider, each page maps to its own isolated state, enabling efficient per-parameter caching for paginated data.

Why does my Riverpod family provider return stale state for different parameters?

A Riverpod family provider returns stale state for different parameters when parameters lack proper equality semantics. Ensuring your parameter objects implement correct equality overrides maintains per-parameter caching and isolated state.