Skip to content
Agentmart
Submit a tool

riverpod-consumers

Use Riverpod Consumer, ConsumerWidget, and ConsumerStatefulWidget to read and watch providers in widgets; WidgetRef, builder ref parameter.

Skill by serverpod

IndexedBSD-3-Clause★ 10
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/serverpod-riverpod-consumers

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use Riverpod Consumer, ConsumerWidget, and ConsumerStatefulWidget to read and watch providers in widgets; WidgetRef, builder ref parameter. Use when building widgets that need to access Riverpod providers, ref.watch or ref.read in the UI, or converting StatelessWidget to ConsumerWidget. Prefer this skill when the user asks how to use providers in Flutter widgets or why ConsumerWidget is required.

Use cases: design

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/riverpod-consumers

What's inside

Skill name
riverpod-consumers
Description
Use Riverpod Consumer, ConsumerWidget, and ConsumerStatefulWidget to read and watch providers in widgets; WidgetRef, builder ref parameter. Use when building widgets that need to access Riverpod providers, ref.watch or ref.read in the UI, or converting StatelessWidget to ConsumerWidget. Prefer this skill when the user asks how to use providers in Flutter widgets or why ConsumerWidget is required.
License
BSD-3-Clause
Instructions
68 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Riverpod — Consumers

## Instructions

Consumers are widgets that give you a **Ref** (here, **WidgetRef**) so you can read and listen to providers. Without a Consumer, widgets cannot access the provider tree.

### Consumer (builder)

Use `Consumer` when you want to keep extending `StatelessWidget` or `StatefulWidget`. The builder callback receives `(context, ref, child)`.

```dart
class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Consumer(
      builder: (context, ref, _) {
        final value = ref.watch(myProvider);
        return Text(value.toString());
      },
    );
  }
}
```

### ConsumerWidget

Subclass `ConsumerWidget` instead of `StatelessWidget`. The `build` method receives `(BuildContext context, WidgetRef ref)`.

```dart
class MyWidget extends ConsumerWidget {
  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final value = ref.watch(myProvider);
    return Text(value.toString());
  }
}
```

### ConsumerStatefulWidget + ConsumerState

When you need a `State` (e.g. for lifecycle or local state), use `ConsumerStatefulWidget` and `ConsumerState`. The state object has a `ref` property.

```dart
class MyWidget extends ConsumerStatefulWidget {
  @override
  ConsumerState<MyWidget> createState() => _MyWidgetState();
}

class _MyWidgetState extends ConsumerState<MyWidget> {
  @override
  Widget build(BuildContext context) {
    final value = ref.watch(myProvider);
    return Text(value.toString());
  }
}
```

### Which to use

- **Consumer** — Use for everything if you prefer not to change your widget base class; slightly more verbose.
- **ConsumerWidget** — Recommended when you don't need State; one less nesting level.
- **ConsumerStatefulWidget** — Use when you need State (e.g. TabController, animations).

### Why not StatelessWidget + context.watch?

Riverpod does not use `BuildContext` to watch providers because that would break **auto-dispose** and other features that rely on knowing when a widget stops listening. Ref-based consumers allow reliable disposal and correct behavior. The hooks_riverpod package also offers HookConsumerWidget etc. for use with flutter_hooks. Enable riverpod_lint for IDE refactors (e.g. "Convert to ConsumerWidget").

From serverpod/skills-registry, BSD-3-Clause.

More from serverpod/skills-registry

Signals

Stars
10
Forks
0
Open issues
0
Last commit (this folder)
Mar 7, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
BSD-3-Clause
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from serverpod

Cite this page

riverpod-consumers skill. Agent Mart. https://agentmart.dev/skills/serverpod-riverpod-consumers (last updated 2026-10-24)