> flutter-riverpod-state-management
Reactive state management using Riverpod 2.0 with code generation. Use when managing state with Riverpod providers or using riverpod_generator in Flutter. (triggers: **_provider.dart, **_notifier.dart, riverpod, ProviderScope, ConsumerWidget, Notifier, AsyncValue, ref.watch, @riverpod)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/flutter-riverpod-state-management?format=md"Riverpod State Management
Priority: P0 (CRITICAL)
Type-safe, compile-time safe reactive state management using riverpod and riverpod_generator.
Structure
lib/
├── providers/ # Global providers and services
└── features/user/
├── providers/ # Feature-specific providers
└── models/ # @freezed domain models
Implementation Guidelines
- Generator First: Use
@riverpodannotations andriverpod_generator. Avoid manualProviderdefinitions. - Immutability: Maintain immutable states. Use
Freezedfor all state models. - Provider Methods:
ref.watch(): Use insidebuild()to rebuild on changes.ref.listen(): Use for side-effects (navigation, dialogs).ref.read(): Use ONLY in callbacks (onPressed).
- Asynchronous Data: Use
AsyncNotifierfor complex async logic. Access data via.when()orAsyncValuepattern-matching. - Architecture: Enforce 3-layer separation (Data, Domain, Presentation).
- Linting: Enable
riverpod_lintandcustom_lintfor dependency cycle detection.
Anti-Patterns
- Building Inside Providers: Don't perform side-effects inside provider initialization.
- Context Access: Never pass
BuildContextinto a Notifier/Provider. - Dynamic Providers: Avoid local provider instantiation; keep them global.
Related Topics
layer-based-clean-architecture | dependency-injection | testing
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)