riverpod-overrides
Override Riverpod providers for tests, debugging, or environment-specific behavior; ProviderScope and ProviderContainer overrides, overrideWith, overrideWithValue. Use when mocking providers in tests, injecting different implementations, or scoping provider behavior. Use this skill when the user asks about overrides, testing Riverpod, or mocking providers.
How do I install this agent skill?
npx skills add https://github.com/serverpod/skills-registry --skill riverpod-overridesIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides instructions and code examples for overriding Riverpod providers in Dart and Flutter for testing and debugging. No security issues were detected.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
- ZeroLeakspass
Score: 93/100 · 2 sections analyzed
What does this agent skill do?
Riverpod — Provider overrides
Instructions
All providers can be overridden to change their behavior. Overrides are set on the container (ProviderScope in Flutter, ProviderContainer in Dart) via the overrides parameter. Use overrides for testing, debugging, different environments, or scoping (see riverpod-scoping).
Where to set overrides
- Flutter: Pass
overridestoProviderScope(usually at the root or around a subtree). - Dart: Pass
overridestoProviderContainer.
Override methods
Each provider type exposes methods whose names start with overrideWith, for example:
- overrideWith — Provide a new implementation (e.g. a function that returns a value or builds state).
- overrideWithValue — Replace with a fixed value (e.g. for FutureProvider/StreamProvider).
- overrideWithBuild — Custom build logic (e.g. for StreamProvider).
Check the provider's API for the exact method (e.g. Provider.overrideWith, FutureProvider.overrideWithValue).
Example: override a counter
// Flutter
void main() {
runApp(
ProviderScope(
overrides: [
counterProvider.overrideWith((ref) => 42),
],
child: MyApp(),
),
);
}
// Dart
final container = ProviderContainer(
overrides: [
counterProvider.overrideWith((ref) => 42),
],
);
Family overrides
- Single parameter: Override one specific argument:
userProvider('123').overrideWith((ref) => User(name: 'User 123')). - All parameters: Override the whole family:
userProvider.overrideWith((ref, arg) => User(name: 'User $arg')).
See riverpod-family and riverpod-testing for more test patterns.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/serverpod/skills-registry/riverpod-overrides">View riverpod-overrides on skillZs</a>