riverpod-codegen-and-hooks

Generates Riverpod providers from annotations and integrates flutter_hooks widget state management.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the development of Riverpod applications by leveraging code generation for providers and integrating seamlessly with Flutter Hooks for local widget state management.

Core Features & Use Cases

  • Riverpod Code Generation: Define providers using concise annotations (@riverpod) for automatic generation, inferring provider types and enabling auto-disposal.
  • Flutter Hooks Integration: Manage local widget state (e.g., controllers, animations) using hooks within Riverpod-aware widgets (HookConsumerWidget or HookConsumer).
  • Use Case: When building a complex UI with Riverpod, use code generation to reduce boilerplate for providers and flutter_hooks to manage local UI state like text field controllers or animation states within a single HookConsumerWidget.

Quick Start

Use the riverpod-codegen-and-hooks skill to define a functional provider named 'example' that returns a string.

Frequently Asked Questions about riverpod-codegen-and-hooks

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

FAQPage Schema
How do I reduce boilerplate when defining providers in Flutter Riverpod?

Riverpod code generation reduces provider boilerplate by using concise annotations like `@riverpod` to automatically infer provider types and enable auto-disposal. This streamlines provider definitions in Dart and Flutter projects.

Does flutter_hooks work with Riverpod for managing local widget state?

Yes, flutter_hooks integrates with Riverpod using `HookConsumerWidget` or `HookConsumer`. This allows you to manage local UI state like text field controllers alongside Riverpod's global state management.

What is the best way to manage both global app state and local UI state in Flutter?

Combining Riverpod code generation for global state and flutter_hooks for local UI state within a single `HookConsumerWidget` provides a streamlined approach. This setup handles complex UIs by separating global providers from local widget lifecycles.

Do I need to understand hook lifecycle rules to use Riverpod with flutter_hooks?

Yes, using Riverpod with flutter_hooks requires understanding both Riverpod provider definitions and hook lifecycle rules. This prerequisite knowledge ensures correct management of local widget state and provider auto-disposal.

Can I use Riverpod code generation to automatically dispose of providers?

Yes, Riverpod code generation enables auto-disposal of providers automatically. By defining providers with functional annotations, the code generator infers types and handles disposal without manual boilerplate.