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,117 forks. 7,408 stars. 169 open issues. Recent commits: Split notifier tests into family/orphan test files (#4929)`notifier`, `async_notifier` and `stream_notifier` each keep theirfamily and orphan classes in part files (`<kind>/family.dart`,`<kind>/orphan.dart`). Those part files had no test at their mirroredpath, so they were listed in `scripts/untested.txt`. As with other partfiles (for example `core/element.dart` →`test/src/core/element_test.dart`), they now get their own tests.For each kind, existing tests move out of`test/src/providers/<kind>_test.dart` as is:- `test/src/providers/<kind>/orphan_test.dart`: the "Throws if usingnotifier properties in its constructor" test (with `CtorNotifier`),"supports overrideWith", and the `provider` and `autoDispose` modifierchecks.- `test/src/providers/<kind>/family_test.dart`: "supports familyoverrideWith", and the `family` and `autoDisposeFamily` modifier checks.`<kind>_test.dart` keeps the matrix tests that run over every variantand the remaining regression tests. Apart from the moves, the onlychanges are imports and `ignore_for_file` lists.`dart test test/src/providers` runs 676 tests both before and after.🤖 Generated with [Claude Code](https://claude.com/claude-code)Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> , GitHub Move tests to the paths tested.sh expects (#4928)These four `lib/` files already had tests, just not at the mirrored`test/` path that `scripts/tested.sh` looks for. Moving the tests letstheir entries leave `scripts/untested.txt`.| lib file | test ||—|—|| `flutter_riverpod/lib/src/core/provider_scope.dart` |`test/provider_scope_test.dart` →`test/src/core/provider_scope_test.dart` ||`flutter_riverpod/lib/src/providers/legacy/change_notifier_provider.dart`| `test/providers/change_notifier/change_notifier_provider_test.dart` →`test/src/providers/legacy/change_notifier_provider_test.dart` || `hooks_riverpod/lib/src/consumer.dart` |`test/hook_consumer_test.dart` → `test/src/consumer_test.dart` || `riverpod_sqflite/lib/src/riverpod_sqflite.dart` |`test/persist_test.dart` → `test/src/riverpod_sqflite_test.dart` |The only code changes are the relative imports, adjusted for the newfolder depth.🤖 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- **Tests** – Updated test references to align with the current project structure.- Improved test maintenance by ensuring shared testing utilities areresolved consistently.- Removed several files from the untested-file tracking list after testcoverage updates.- **Chores**- Refined internal test configuration without changing exported APIs orend-user functionality.<!– end of auto-generated comment: release notes by coderabbit.ai –>Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> , GitHub Require every lib/x.dart to have a test/x_test.dart (#4927)Follow-up to #4922 and #4924: `scripts/check.sh tested` now also failswhen a `lib/**/x.dart` file has no `test/**/x_test.dart` at all, notonly when it changes without its test.- **Exempt:** example packages (`examples/*`, `*/example`, `benchmarks`,`website`, `other_projects/*`), generated files, and files with onlydirectives (export/import/library/part, optionally annotated), such asthe public barrels and part-collecting libraries like `framework.dart`.- **Baseline:** the 119 files without a test today are listed in`scripts/untested.txt`. The list may only shrink: an entry whose filenow has a test, or no longer exists, fails the check.- `CONTRIBUTING.md`, the `check.sh` help and the CI job name areupdated.Verified locally: passes on the current tree; fails on a new untestedlib file and on a stale baseline entry.🤖 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- **Tests**- Expanded automated checks to verify library files have correspondingtests across the project.- Added validation for stale test exemptions and mismatched library/testfiles.- Preserved exceptions for generated, example, and directive-only files.- **Documentation**- Clarified testing requirements, exemptions, and expected library/testfile structure for contributors.- **Chores**- Added a tracking list for existing library files that still requiretests.<!– end of auto-generated comment: release notes by coderabbit.ai –>Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> , GitHub chore(deps): bump launch-editor from 2.14.1 to 2.14.2 in /website (#4926)Bumps [launch-editor](https://github.com/vitejs/launch-editor) from2.14.1 to 2.14.2.<details><summary>Commits</summary><ul><li><ahref="https://github.com/vitejs/launch-editor/commit/b5334895a00f8000ef3b6a46f2aa9e1a62eb27b4"><code>b533489</code></a>v2.14.2</li><li><ahref="https://github.com/vitejs/launch-editor/commit/f13cd835d4b8e860b1d4d080ad8a490cc2463679"><code>f13cd83</code></a>fix: check file existence after path resolution (<ahref="https://redirect.github.com/vitejs/launch-editor/issues/157">#157</a>)</li><li><ahref="https://github.com/vitejs/launch-editor/commit/f6e6701bb1f16f2dd242b321374f1b6cca6eb6d4"><code>f6e6701</code></a>fix: ensure filenames passed to editors are not considered as flags (<ahref="https://redirect.github.com/vitejs/launch-editor/issues/156">#156</a>)</li><li><ahref="https://github.com/vitejs/launch-editor/commit/3c2f9bf2ff8fe63d056a8f9cc52d825b66ca79fc"><code>3c2f9bf</code></a>fix: reject paths containing <code>%</code> on windows (<ahref="https://redirect.github.com/vitejs/launch-editor/issues/155">#155</a>)</li><li><ahref="https://github.com/vitejs/launch-editor/commit/ecdfce1f9ec56a9c08f225f27d8047f3cf9690b1"><code>ecdfce1</code></a>refactor: extract <code>constructWindowsLaunchCommand</code> (<ahref="https://redirect.github.com/vitejs/launch-editor/issues/154">#154</a>)</li><li><ahref="https://github.com/vitejs/launch-editor/commit/24d5d8442a022a83c9c9c486b18a3bc4236cf45a"><code>24d5d84</code></a>fix: correctly show error when the third parameter is not passed (<ahref="https://redirect.github.com/vitejs/launch-editor/issues/153">#153</a>)</li><li><ahref="https://github.com/vitejs/launch-editor/commit/7bae9bc13120ccc8c9d8a94204a63f0bf3bb33d7"><code>7bae9bc</code></a>refactor: merge statements</li><li><ahref="https://github.com/vitejs/launch-editor/commit/571fe00a626450649af519247a33aabe8ea246a6"><code>571fe00</code></a>chore(deps): update actions/setup-node action to v7 (<ahref="https://redirect.github.com/vitejs/launch-editor/issues/149">#149</a>)</li><li><ahref="https://github.com/vitejs/launch-editor/commit/d8ed4233db1fc1f82164f12635c65fe54aaf758c"><code>d8ed423</code></a>chore(deps): update actions/checkout action to v7 (<ahref="https://redirect.github.com/vitejs/launch-editor/issues/148">#148</a>)</li><li><ahref="https://github.com/vitejs/launch-editor/commit/75b3e6ce27309d5f005769e68deaa94c090cb61d"><code>75b3e6c</code></a>fix(deps): update all non-major dependencies (<ahref="https://redirect.github.com/vitejs/launch-editor/issues/146">#146</a>)</li><li>Additional commits viewable in <ahref="https://github.com/vitejs/launch-editor/compare/v2.14.1…v2.14.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 chore(deps): bump follow-redirects from 1.16.0 to 1.16.1 in /website (#4925)Bumps[follow-redirects](https://github.com/follow-redirects/follow-redirects)from 1.16.0 to 1.16.1.<details><summary>Commits</summary><ul><li><ahref="https://github.com/follow-redirects/follow-redirects/commit/46301256333c90b7faac7aa126effe72ec16d16e"><code>4630125</code></a>Release version 1.16.1 of the npm package.</li><li><ahref="https://github.com/follow-redirects/follow-redirects/commit/9865ca45490e4d0f7b6944870318408344570aff"><code>9865ca4</code></a>Support key/value header arrays.</li><li><ahref="https://github.com/follow-redirects/follow-redirects/commit/080a76d0e125b37bf81717368a61d5dc37aa56c8"><code>080a76d</code></a>Escape all RegExp modifiers.</li><li>See full diff in <ahref="https://github.com/follow-redirects/follow-redirects/compare/v1.16.0…v1.16.1">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
Provides the list of the opensource Flutter apps collection with GitHub repository.