Welcome to Riverpod !
This project can be considered as a rewrite of provider to make improvements that would be otherwise impossible.
For learning how to use Riverpod , see its documentation: https://riverpod.dev
Long story short:
Declare your providers as global variables:final myNotifierProvider = ChangeNotifierProvider((_) {
return MyNotifier();
});
class MyNotifier extends ChangeNotifier {
int count;
// TODO: typical ChangeNotifier logic
} Use them inside your widgets in a compile-time safe way. No runtime exceptions!class Example extends ConsumerWidget {
@override
Widget build(BuildContext context, ScopedReader watch) {
final count = watch(myNotifierProvider);
return Text(count.toString());
}
}
See the FAQ if you have questions around what this means for provider .
Motivation
If provider is a simplification of InheritedWidget s, then Riverpod is a reimplementation of InheritedWidget s from scratch.
It is very similar to provider in principle, but also has major differences as an attempt to fix the common problems that provider face.
Riverpod has multiple goals. First, it inherits the goals of provider :
Being able to safely create, observe and dispose states without having to worry about losing the state on widget rebuild. Making our objects visible in Flutter’s devtool by default. Testable and composable Improve the readability of InheritedWidget s when we have multiple of them (which would naturally lead to a deeply nested widget tree). Make apps more scalable with a unidirectional data-flow.
From there, Riverpod goes a few steps beyond:
Reading objects is now compile-safe . No more runtime exception. It makes the provider pattern more flexible, which allows supporting commonly requested features like:Being able to have multiple providers of the same type. Disposing the state of a provider when it is no longer used. Have computed states Making a provider private. Simplifies complex object graphs. It is easier to depend on asynchronous state. Makes the pattern independent from Flutter
These are achieved by no longer using InheritedWidget s. Instead, Riverpod implements its own mechanism that works in a similar fashion.
For learning how to use Riverpod , see its documentation: https://riverpod.dev
Contributing
Contributions are welcomed!
Here is a curated list of how you can help:
Report bugs and scenarios that are difficult to implement Report parts of the documentation that are unclear Update the documentation / add examples Implement new features by making a pull-request
FAQ
Why another project when provider already exists?
While provider is largely used and well accepted by the community, it is not perfect either.
People regularly file issues or ask questions about some problems they face, such as:
Why do I have a ProviderNotFoundException? How can I make that my state automatically disposed of when not used anymore? How to make a provider that depends on other (potentially complex) providers?
These are legitimate problems, and I believe that something can be improved to fix those.
The issue is, these problems are deeply rooted in how provider works, and fixing those problems is likely impossible without drastic changes to the mechanism of provider .
In a way, if provider is a candle then Riverpod is a lightbulb. They have very similar usages, but we cannot create a lightbulb by improving our candle.
Is it safe to use in production?
Yes, but with caution.
Riverpod recently left its experimental status, but it isn’t fully stable either. The API may change slightly when more features are added, and some use-cases may not be as simple as they could be.
But overall, you should be able to use Riverpod without trouble.
Will this get merged with provider at some point?
No. At least not until it is proven that the community likes Riverpod and that it doesn’t cause more problems than it solves.
While provider and this project have a lot in common, they do have some major differences. Differences big enough that it would be a large breaking change for users of provider to migrate Riverpod .
Considering that, separating both projects initially sounds like a better compromise.
Will provider be deprecated/stop being supported?
Not in the short term, no.
This project is still experimental and unpopular. While it is, in a way, a provider 2.0, its worth has yet to be proven.
Until it is certain that Riverpod is a better way of doing things and that the community likes it, provider will still be maintained.
Download Riverpod package source code on GitHub
A reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze. https://github.com/rrousselGit/riverpod 1,119 forks. 7,437 stars. 167 open issues. Recent commits: Fix generated overrideWithValue on class-based providers breaking .notifier (#5007)fixes #4699The generated `overrideWithValue` of a class-based provider replaced itwith a value provider, so no notifier element existed and reading`.notifier` failed with a type cast error.- **`riverpod`:** new internal `$ClassProvider.$overrideWithValue`,which keeps the notifier and uses the value as its state.- **`riverpod_generator`:** class-based providers now emit `return$overrideWithValue(value);`. The 59 regenerated `.g.dart` files containonly that change.Behaviour to be aware of:- Updating the override with a new value (`ProviderScope(overrides:[p.overrideWithValue(x)])` rebuilt with another `x`) resets the state toit, as before. A same-value update keeps changes the notifier made.- `dependencies` are now kept on the override, like `overrideWith` and`overrideWithBuild`.- Users need to regenerate, and the new generator output needs the new`riverpod` release.🤖 Generated with [Claude Code](https://claude.com/claude-code)<!– This is an auto-generated comment: release notes by coderabbit.ai–><!– coderabbit-ai-generated:v1 –>## Summary by CodeRabbit* **Bug Fixes*** Fixed a type error when accessing `provider.notifier` after overridinga generated notifier provider with a value. The notifier remainsavailable, and the override replaces its state.* Changing the override value now updates provider state and notifieslisteners without recreating or disposing the notifier. Regenerategenerated code with the latest `riverpod_generator` to receive the fix.<!– end of auto-generated comment: release notes by coderabbit.ai –>———Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> , GitHub chore(deps): bump js-yaml from 3.15.0 to 3.15.2 in /website (#5011)Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.15.0 to3.15.2.<details><summary>Changelog</summary><p><em>Sourced from <ahref="https://github.com/nodeca/js-yaml/blob/3.15.2/CHANGELOG.md">js-yaml'schangelog</a>.</em></p><blockquote><h2>3.15.2 – 2026-08-26</h2><h3>Changed</h3><ul><li>[backport] Hard-limit merge sequence size to 100.</li></ul><h3>Security</h3><ul><li>[backport] Count empty mappings in merge sequences toward<code>maxTotalMergeKeys</code>to limit CPU usage, <ahref="https://redirect.github.com/nodeca/js-yaml/issues/797">#797</a>.</li></ul><h2>3.15.1 – 2026-07-31</h2><h3>Security</h3><ul><li>[backport] Remove quadratic complexity from <code>!!omap</code>duplicate key detection.</li></ul></blockquote></details><details><summary>Commits</summary><ul><li><ahref="https://github.com/nodeca/js-yaml/commit/5c45bd6e960603c13644f5cc8b572ca257723b36"><code>5c45bd6</code></a>3.15.2 released</li><li><ahref="https://github.com/nodeca/js-yaml/commit/5a708f9f4f22e78b87ebe363848cfa4fa4818c0d"><code>5a708f9</code></a>dist rebuild</li><li><ahref="https://github.com/nodeca/js-yaml/commit/3485bc06ff8a0251505f44a00414d90df2466639"><code>3485bc0</code></a>Backport merge limits from v5.4.1</li><li><ahref="https://github.com/nodeca/js-yaml/commit/f34812f1cea794f8c21e0a4e1f3a2584b720f305"><code>f34812f</code></a>Update .gitignore</li><li><ahref="https://github.com/nodeca/js-yaml/commit/ab85ae2c622bc6d8cdbceccafe9f9b7df80463ed"><code>ab85ae2</code></a>3.15.1 released</li><li><ahref="https://github.com/nodeca/js-yaml/commit/30a5e7647a4454f7bac969bfbbe7eac9921a4279"><code>30a5e76</code></a>dist rebuild</li><li><ahref="https://github.com/nodeca/js-yaml/commit/22a8071ef032117bc6249c330b240ac3aa2d3ded"><code>22a8071</code></a>Backport quadratic complexity fix for !!omap</li><li>See full diff in <ahref="https://github.com/nodeca/js-yaml/compare/3.15.0…3.15.2">compareview</a></li></ul></details><br />[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)Dependabot will resolve any conflicts with this PR as long as you don'talter it yourself. You can also trigger a rebase manually by commenting`@dependabot rebase`.[//]: # (dependabot-automerge-start)[//]: # (dependabot-automerge-end)—<details><summary>Dependabot commands and options</summary><br />You can trigger Dependabot actions by commenting on this PR:- `@dependabot rebase` will rebase this PR- `@dependabot recreate` will recreate this PR, overwriting any editsthat have been made to it- `@dependabot show <dependency name> ignore conditions` will show allof the ignore conditions of the specified dependency- `@dependabot ignore this major version` will close this PR and stopDependabot creating any more for this major version (unless you reopenthe PR or upgrade to it yourself)- `@dependabot ignore this minor version` will close this PR and stopDependabot creating any more for this minor version (unless you reopenthe PR or upgrade to it yourself)- `@dependabot ignore this dependency` will close this PR and stopDependabot creating any more for this dependency (unless you reopen thePR or upgrade to it yourself)You can disable automated security fix PRs for this repo from the[Security Alertspage](https://github.com/rrousselGit/riverpod/network/alerts).</details>Signed-off-by: dependabot[bot] <support@github.com>Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> , GitHub Keep import prefixes in generated JSON decoding and dependencies (#5006)Two places where generated code dropped the import prefix of somethingthe user imported with `import … as prefix`:- **`@JsonPersist` decoding:** generated `Model.fromJson(…)` insteadof `p.Model.fromJson(…)`. `json_generator.dart` wrote the type with`getDisplayString()` instead of `analyzer_buffer`'s `toCode()`, whichevery other generated type goes through.- **Prefixed dependencies:** `@Riverpod(dependencies: [p.dep])` on afunction was rejected by the parser, and `[p.Dep]` on a class generatedan unprefixed `depProvider`.This does not fix #4372. Both were found while checking that issue, butthey are separate defects: #4372 (`intl.Locale` generated as`ui.Locale`) was a bug in `analyzer_buffer`, fixed in its 0.1.12release, and no longer reproduces on master. #5008 adds the regressiontest for it.Things to know when reviewing:- **Dependency prefix:** the generated reference reuses the prefixwritten in the annotation (`p.dep` gives `p.depProvider`) rather thanasking `analyzer_buffer` for it. `analyzer_buffer` finds a prefix bylooking the symbol up in the imports, and `depProvider` lives in thedependency's generated part, which may not exist yet when the dependentlibrary is generated.- **Release:** `riverpod_analyzer_utils` gains a public`ProviderDependency.importPrefix` getter, which `riverpod_generator` nowneeds, so the two have to be released together.- **Tests:** new in-process generator tests live under`riverpod_generator/test/src`, and three lines are removed from`baselines/untested.txt`.- **Not fixed:** a nullable generic state such as `Future<Box<int>?>`with `@JsonPersist` generates `Box<int>?.fromJson(…)`, which does notparse. It is unrelated to prefixes.🤖 Generated with [Claude Code](https://claude.com/claude-code)<!– This is an auto-generated comment: release notes by coderabbit.ai–><!– coderabbit-ai-generated:v1 –>## Summary by CodeRabbit* **Bug Fixes*** Provider dependencies imported with a prefix are now recognized, andgenerated references preserve the correct prefix for both direct andtransitive dependencies.* Functions can use prefixed providers in their dependency lists withouttriggering a parsing error.* JSON persistence now generates decoding code that supports typesimported with a prefix, including types nested in collections andgeneric types. Unprefixed types continue to be handled as before.<!– end of auto-generated comment: release notes by coderabbit.ai –>———Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> , GitHub Check that the links of the docs and of the Dart comments are valid (#5010)Adds `scripts/links.sh`, run as the `links` step of `scripts/check.sh`and in the "Format, analyze & links" CI job.## What it checks- **Markdown and MDX**: inline links and images, reference links (anundefined `[text][label]` fails), `href`/`src`/`to` attributes, and bareURLs. Code blocks, backticked code and comments have no links.- **Components of the website**: `<Link documentID="…" hash="…" />` mustname a page and one of its headings, and `<DartPad id="…" />` a gist.- **Dart**: the URLs in comments, not in strings.- **Paths and fragments**: a path must be a file of the repository or,in the docs, a page or a static file of the website. A `#fragment` mustbe a heading of the Markdown file it links.- **URLs of `riverpod.dev` and of this repository on GitHub**: checkedagainst the working copy rather than the network, so they can link whata PR adds.- **Other URLs**: requested. A 404, a 410 or an unknown host fails. A403, a 5xx or a timeout is only listed as unverified. `scripts/links.sh–offline` skips the requests.## Broken links fixed- Two `<Link>` whose `hash` named a heading that no longer exists(`enabling-riverpod_lintcustom_lint`).- `/docs/about_code_generation`, now`/docs/concepts/about_code_generation`.- The API page of `ChangeNotifier` on api.flutter.dev, which moved.- A removed page of the website that the changelogs of three packageslinked, now the API page of `Provider.autoDispose`.## Exempt, in `baselines/links.yaml`- `website/i18n/**`: the translations have 96 broken links, and areexempt as they are from the snippets check.## Not checked- The fragments of external URLs.- The links of `docusaurus.config.js`, `sidebars.js` and the `.tsx`files.The logic is in `tools/repo_checks/lib/src/link_extraction.dart` and`link_check.dart`, with their tests. `bin/check_links.dart` lists thefiles and makes the requests.🤖 Generated with [Claude Code](https://claude.com/claude-code)<!– This is an auto-generated comment: release notes by coderabbit.ai–><!– coderabbit-ai-generated:v1 –>## Summary by CodeRabbit* **Documentation*** Corrected links in the documentation for lint setup, code generation,and `ChangeNotifier`, helping readers reach the intended guidance.* **Chores*** Added automated link validation to the project’s checks, includingchecks for local references and external URLs. Contributors can run thecheck offline when needed.<!– end of auto-generated comment: release notes by coderabbit.ai –>———Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> , GitHub Website: fix dead pub.dev API reference links (#5009)## Related IssuesNone (documentation only).Seven pub.dev API links in the English docs return 404, because thesymbols live in a different library or page in the 3.x API docs:- `3.0_migration.mdx`: `StreamNotifierProvider.html` ->`StreamNotifierProvider-class.html`; `ProviderBase` and`ProviderException` now link to the `misc` library, where they aredocumented.- `concepts2/retry.mdx`: `ProviderException` -> the `misc` library page.- `concepts2/refs.mdx`: `misc/ProviderListenable/select.html` ->`hooks_riverpod/ProviderListenableSelect/select.html` (the extensionthat defines `select`).- `concepts2/overrides.mdx`: `overrideWithBuild` linked to`StreamProvider/overrideWithBuild.html`, but `StreamProvider` has nosuch method; it now links to`StreamNotifierProvider/overrideWithBuild.html` (`overrideWithBuild` ison the notifier providers).- `tutorials/first_app.mdx`: `AsyncValueX/isRefreshing.html` ->`AsyncValueExtensions/isRefreshing.html`.Every old URL returns 404 and every new one returns 200 (checked withcurl). Only link targets changed.## Checklist- [ ] I have updated the `CHANGELOG.md` of the relevant packages. (Notapplicable: website docs only.)- [ ] If this contains new features or behavior changes,I have updated the documentation to match those changes. (Notapplicable.)<!– This is an auto-generated comment: release notes by coderabbit.ai–><!– coderabbit-ai-generated:v1 –>## Summary by CodeRabbit* **Documentation*** Corrected API reference links in the migration guide, concepts, andtutorial pages so they point to the appropriate documentation pages.<!– end of auto-generated comment: release notes by coderabbit.ai –> , GitHub
Provides the list of the opensource Flutter apps collection with GitHub repository.