Riverpod logo

Riverpod

CommunityPopular
andrewyng
riverpod

Use when working with Flutter Riverpod state management. Covers providers, consumers, refs, containers, overrides, async state, code generation, testing, and safe defaults.

Overview

Publisherandrewyng
Repositorycontext-hub
Skill nameriverpod
Stars
14K
Forks
1.2K
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by andrewyng on GitHub. Read the source before you install it.

Installation

Install the Riverpod AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/andrewyng/context-hub.git /tmp/context-hub
mkdir -p .claude/skills
cp -r /tmp/context-hub/content/flutter/skills/state-management/riverpod .claude/skills/riverpod
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Riverpod in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Riverpod on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Riverpod is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Flutter Riverpod State Management

Use this skill when building Flutter state management with riverpod and flutter_riverpod.

Core Rule

  • Use Provider for read-only values and dependency wiring.
  • Use StateProvider for small mutable state.
  • Use FutureProvider for one-shot async loading.
  • Use StreamProvider for reactive streams.
  • Use Notifier or AsyncNotifier for feature state that needs mutation methods.
  • Use autoDispose for short-lived state.
  • Use family when provider output depends on an argument.
  • Use flutter_riverpod in Flutter apps.
  • If you use flutter_riverpod, you usually do not add riverpod separately because the Flutter package brings it in transitively.
  • Current stable line is Riverpod 3.x (riverpod 3.2.1, flutter_riverpod 3.3.1).

Decision Guide

Choose Riverpod when:

  • you want provider-based dependency injection and reactive state in one model
  • state should be derived from other providers
  • async data is a major part of the feature
  • test overrides and scoped state matter
  • you want fewer classes than a Bloc-heavy approach

Choose a different pattern when:

  • the feature is a tiny local state toggle and a simple widget would be enough
  • the logic is better expressed as an explicit event machine

Required Project Setup

For Dart-only code:

  • add riverpod

For Flutter UI code:

  • add flutter_riverpod
  • wrap the app in ProviderScope
  • use ConsumerWidget, Consumer, or ConsumerStatefulWidget where ref is needed

If code generation is used:

  • add riverpod_annotation
  • add riverpod_generator
  • add build_runner

Implementation Pattern

Prefer this structure:

  • providers own state, dependencies, and derived values
  • repositories and APIs stay outside widgets
  • UI reads state with ref.watch
  • UI performs imperative reads with ref.read
  • container-level overrides are used for tests, demos, and environment-specific wiring

Keep providers small and composable. Keep state immutable unless the provider type is specifically meant for mutation. Keep feature logic in providers or notifiers, not in widgets.

Lifecycle Rules

  • Use autoDispose for short-lived screens and transient queries.
  • Use ref.keepAlive() only when you want cached state to survive temporarily.
  • Prefer provider disposal over manual cleanup.
  • In tests and pure Dart code, dispose ProviderContainer when finished.

UI Binding Rules

Use ConsumerWidget when the whole widget depends on providers. Use Consumer when only a small subtree needs access to ref. Use ConsumerStatefulWidget when you need widget lifecycle plus ref. Use select to reduce rebuilds. Use ProviderListener or ref.listen for side effects.

Testing Rules

  • Test providers through ProviderContainer.
  • Override dependencies instead of mocking provider internals.
  • Assert AsyncValue states directly for async providers.
  • Dispose containers in tests.

Common Pitfalls

  • Do not call ref.watch inside callbacks; use ref.read there.
  • Do not skip ProviderScope at the app root.
  • Do not use StateProvider for large feature state.
  • Do not put business logic in widgets.
  • Do not rebuild the whole tree when a single field changes; use select.
  • Do not model async loading manually when FutureProvider or AsyncNotifier fits.
  • Do not forget provider overrides for tests and previews.

What To Prefer In Answers

When writing code or advising on design:

  • show the smallest working provider first
  • mention whether ProviderScope is required
  • mention whether the provider should be autoDispose or cached
  • mention whether a family is needed for arguments
  • include test override notes when dependencies are external
  • keep examples aligned with the current Riverpod docs and Flutter integration patterns
  • if code generation is involved, prefer matching riverpod_annotation / riverpod_generator versions from the same 3.x release line

Minimal Reference Checklist

  • ProviderScope = app root setup
  • ref.watch = rebuild on change
  • ref.read = imperative access
  • select = narrower rebuilds
  • autoDispose = short-lived state
  • family = parameterized provider
  • ProviderContainer = test/headless container

Frequently asked questions

What does the Riverpod AI skill do?

Use when working with Flutter Riverpod state management. Covers providers, consumers, refs, containers, overrides, async state, code generation, testing, and safe defaults.

Why use Riverpod on TypingMind?

Because you install it once and use it with any model. Riverpod is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Riverpod in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/andrewyng/context-hub/tree/main/content/flutter/skills/state-management/riverpod. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Riverpod?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Riverpod?

As many as you like. As long as a model supports skills, you can use Riverpod with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Riverpod AI skill free?

Yes. It is published on GitHub by andrewyng under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇