riverpod-consumers

Read and listen to Riverpod providers in Flutter widgets using Consumer classes.

Updated Mar 28, 2026
One-click install
npx skills add https://github.com/masssi164/weave --skill riverpod-consumers-masssi164
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: riverpod-consumers
Source: https://github.com/masssi164/weave/tree/main/.agent/skills/riverpod-consumers
Command: npx skills add https://github.com/masssi164/weave --skill riverpod-consumers-masssi164

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Riverpod consumers enable Flutter UI code to read and listen to provider values directly from widget trees, enabling reactive interfaces without boilerplate or prop drilling.

Core Features & Use Cases

  • Use Consumer to access a WidgetRef inside a small portion of the widget tree without converting the entire widget to a consumer-based base.
  • Use ConsumerWidget to simplify stateless widgets that only read providers, improving readability and reducing boilerplate.
  • Use ConsumerStatefulWidget when you need local state alongside provider listening, such as animations or controller-driven UI.
  • Understand why ref.watch and ref.read are preferred over context-based provider lookups and how Riverpod's auto-dispose model prevents leaks.

Quick Start

Wrap a portion of your UI with Consumer and call ref.watch(myProvider) to react to changes.

Frequently Asked Questions about riverpod-consumers

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

FAQPage Schema
How do I use ref.watch and ref.read to listen to Riverpod providers in Flutter widgets?

To read and listen to Riverpod providers in Flutter widgets, use ref.watch inside the build method to react to live provider value changes, and use ref.read for one-time reads inside event handlers to access current state without subscribing.

When should I use ConsumerWidget vs ConsumerStatefulWidget in Riverpod?

Use ConsumerWidget for stateless widgets that only read providers to reduce boilerplate. Use ConsumerStatefulWidget when your widget needs local state alongside provider listening, such as for animations or controller-driven UI that requires lifecycle management.

Can I access a WidgetRef in a small part of my Flutter widget tree without converting the entire widget?

Yes, you can wrap a specific portion of your Flutter UI tree with Consumer. This allows you to access a WidgetRef and call ref.watch on Riverpod providers locally without converting the entire parent widget to a consumer-based base class.

Why does Riverpod prefer ref.watch over context-based provider lookups for Flutter state?

Riverpod prefers ref.watch over context-based provider lookups because it directly wires provider state into the UI, enabling reactive interfaces without prop drilling. Additionally, Riverpod's auto-dispose model prevents memory leaks that context-based lookups might cause.

How do I select the appropriate Riverpod consumer base class to ensure proper state synchronization?

Select your Riverpod consumer base class based on state needs: ConsumerWidget for simple stateless provider reads, ConsumerStatefulWidget for local state and controller-driven UI, and Consumer for localized WidgetRef access without altering the base class.