Skip to content
This repository was archived by the owner on Oct 5, 2025. It is now read-only.
/riverpodPublic archive
forked from rrousselGit/riverpod

A reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.

License

Notifications You must be signed in to change notification settings

Cause-App/riverpod

Repository files navigation

Build StatuscodecovStar on GithubLicense: MITDiscord

Deploys by Netlify

Riverpod


A reactive caching and data-binding framework. https://riverpod.dev Riverpod makes working with asynchronous code a breeze by:

  • handling errors/loading states by default. No need to manually catch errors
  • natively supporting advanced scenarios, such as pull-to-refresh
  • separating the logic from your UI
  • ensuring your code is testable, scalable and reusable
riverpodpub package
flutter_riverpodpub package
hooks_riverpodpub package

Welcome to Riverpod (anagram of Provider)!

For learning how to use Riverpod, see its documentation: >>> https://riverpod.dev <<<

Long story short:

  • Define network requests by writing a function annotated with @riverpod:

    @riverpodFuture<String> boredSuggestion(BoredSuggestionRef ref) async{final response =await http.get( Uri.https('boredapi.com', '/api/activity'), ); final json =jsonDecode(response.body); return json['activity']!asString}
  • Listen to the network request in your UI and gracefully handle loading/error states.

    classHomeextendsConsumerWidget{@overrideWidgetbuild(BuildContext context, WidgetRef ref){final boredSuggestion = ref.watch(boredSuggestionProvider); // Perform a switch-case on the result to handle loading/error statesreturnswitch (boredSuggestion){AsyncData(:final value) =>Text('data: $value'), AsyncError(:final error) =>Text('error: $error'), _ =>constText('loading'), }} }

Contributing

Contributions are welcome!

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
  • Fix typos/grammar mistakes
  • Update the documentation or add examples
  • Implement new features by making a pull-request

Sponsors

About

A reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart50.0%
  • MDX47.2%
  • JavaScript1.6%
  • TypeScript1.1%
  • SCSS0.1%
  • CSS0.0%