riverpod-overrides

Override Riverpod providers using overrideWith, overrideWithValue, and overrideWithBuild methods.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill allows you to precisely control the behavior of Riverpod providers, which is essential for effective testing, debugging, and managing environment-specific configurations.

Core Features & Use Cases

  • Provider Mocking: Easily replace providers with mock implementations during tests.
  • Behavior Modification: Change provider outputs or logic for different scenarios (e.g., development vs. production).
  • Scoped Behavior: Apply specific provider configurations to a subset of your application.
  • Use Case: When testing a feature that relies on a FutureProvider fetching user data, use this Skill to override the provider with a mock User object, ensuring predictable test results without making actual network requests.

Quick Start

Override the counterProvider with a value of 42 in your test setup.

Frequently Asked Questions about riverpod-overrides

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

FAQPage Schema
How do I mock Riverpod providers in Flutter tests?

Mock Riverpod providers in Flutter tests by replacing real implementations with mock data using the `overrideWithValue` or `overrideWith` methods. This isolates components and ensures predictable application states without making actual network requests.

Can I override specific arguments in a Riverpod provider family?

Yes, you can override specific arguments within Riverpod provider families during testing. This allows you to target and modify individual family instances rather than replacing the entire provider family globally.

What is the best way to control Riverpod provider behavior for different environments?

Control Riverpod provider behavior for different environments by applying overrides to modify provider outputs or logic. This approach allows you to scope specific provider configurations to development or production environments seamlessly.

Does Riverpod overriding work for isolating components during debugging?

Yes, Riverpod overriding works for isolating components during debugging. By using `overrideWith` or `overrideWithBuild`, you can replace dependencies with controlled mock implementations to ensure predictable states and isolate issues.

How do I override a FutureProvider with a mock object in Dart?

Override a Dart FutureProvider with a mock object by using the `overrideWithValue` method in your test setup. This bypasses actual data fetching, returning a predictable mock object like a test `User` directly.