riverpod-containers

Manage Riverpod state with ProviderScope in Flutter and ProviderContainer in Dart.

8|Updated Mar 7, 2026
One-click install
npx skills add https://github.com/serverpod/skills-registry --skill riverpod-containers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: riverpod-containers
Source: https://github.com/serverpod/skills-registry/tree/main/skills/riverpod/riverpod-containers
Command: npx skills add https://github.com/serverpod/skills-registry --skill riverpod-containers

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill clarifies where and how Riverpod manages state, enabling effective setup in Flutter and Dart applications, and facilitating robust testing.

Core Features & Use Cases

  • State Management: Understand that ProviderContainer (or ProviderScope in Flutter) is where Riverpod state is stored.
  • Testing: Learn to use ProviderContainer.test() for isolated and reliable unit tests.
  • Configuration: Discover how to set up overrides and observers at the container level.

Quick Start

Use the riverpod-containers skill to learn how to set up a ProviderScope in your Flutter app.

Frequently Asked Questions about riverpod-containers

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

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

To set up Riverpod state management in Flutter, you use a `ProviderScope` widget at the root of your application. This widget creates and manages the `ProviderContainer`, which is where all Riverpod state is actually stored and accessed.

How does ProviderContainer work in Dart applications outside of Flutter?

`ProviderContainer` works in Dart by acting as the core storage mechanism for Riverpod state when Flutter widgets are unavailable. It allows you to manually read providers, manage state lifecycle, and configure overrides and observers independently.

How do I write unit tests for Riverpod providers?

You write unit tests for Riverpod providers by using the `ProviderContainer.test()` method. This creates an isolated container that allows you to override specific providers and reliably verify state logic without needing a full Flutter widget tree.

Can I override providers and add observers at the container level in Riverpod?

Yes, you can configure overrides and observers directly at the `ProviderContainer` or `ProviderScope` level. This allows you to inject mock dependencies for testing or monitor state lifecycle changes globally across your application.

What is the difference between ProviderScope and ProviderContainer?

`ProviderScope` is a Flutter widget that creates a `ProviderContainer` for the widget tree, while `ProviderContainer` is the underlying Dart class where Riverpod state is actually stored. `ProviderContainer` can also be used directly for testing or non-Flutter Dart apps.