Skip to content
Back to skills

Riverpod State Management

ASecurity

Reactive state management using Riverpod 2.0 with code generation.

  • 8 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
ai-agentsreacttesting

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add ngxtm/devkit --skill riverpod-state-management --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Riverpod State Management?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Riverpod State Management
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ngxtm-riverpod-state-management/badge)](https://www.skillsdirectory.com/skills/ngxtm-riverpod-state-management)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: Flutter Riverpod State Management
description: Reactive state management using Riverpod 2.0 with code generation.
metadata:
  labels: [state-management, riverpod, dependency-injection, reactive]
  triggers:
    files: ['**_provider.dart', '**_notifier.dart']
    keywords: [riverpod, ProviderScope, ConsumerWidget, Notifier, AsyncValue, ref.watch, "@riverpod"]
---

# Riverpod State Management

## **Priority: P0 (CRITICAL)**

Type-safe, compile-time safe reactive state management using `riverpod` and `riverpod_generator`.

## Structure

```text
lib/
├── providers/ # Global providers and services
└── features/
    └── user/
        ├── providers/ # Feature-specific providers
        └── models/    # @freezed domain models
```

## Implementation Guidelines

- **Generator First**: Use `@riverpod` annotations and `riverpod_generator`. Avoid manual `Provider` definitions.
- **Immutability**: Maintain immutable states. Use `Freezed` for all state models.
- **Provider Methods**:
  - `ref.watch()`: Use inside `build()` to rebuild on changes.
  - `ref.listen()`: Use for side-effects (navigation, dialogs).
  - `ref.read()`: Use ONLY in callbacks (onPressed).
- **Asynchronous Data**: Use `AsyncNotifier` for complex async logic. Access data via `.when()` or `AsyncValue` pattern-matching.
- **Architecture**: Enforce 3-layer separation (Data, Domain, Presentation).
- **Linting**: Enable `riverpod_lint` and `custom_lint` for dependency cycle detection.

## Anti-Patterns

- **Building Inside Providers**: Don't perform side-effects inside provider initialization.
- **Context Access**: Never pass `BuildContext` into a Notifier/Provider.
- **Dynamic Providers**: Avoid local provider instantiation; keep them global.

## Reference & Examples

For architecture details, best practices, and testing overrides:
See [references/architecture.md](references/architecture.md), [references/best-practices.md](references/best-practices.md), and [references/testing.md](references/testing.md).

## Related Topics

feature-based-clean-architecture | dependency-injection | testing

Files in this skill

  • SKILL.md2.1 KB
  • references/architecture.md3.4 KB
  • references/best-practices.md2.5 KB
  • references/testing.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…