# riverpod **Repository Path**: hlj1013/riverpod ## Basic Information - **Project Name**: riverpod - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-10-16 - **Last Updated**: 2023-10-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

Build Status codecov Star on Github License: MIT Discord

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 scenearios, such as pull-to-refresh - separating the logic from your UI - ensuring your code is testable, scalable and reusable | riverpod | [![pub package](https://img.shields.io/pub/v/riverpod.svg?label=riverpod&color=blue)](https://pub.dartlang.org/packages/riverpod) | | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | flutter_riverpod | [![pub package](https://img.shields.io/pub/v/riverpod.svg?label=flutter_riverpod&color=blue)](https://pub.dartlang.org/packages/flutter_riverpod) | | hooks_riverpod | [![pub package](https://img.shields.io/pub/v/riverpod.svg?label=hooks_riverpod&color=blue)](https://pub.dartlang.org/packages/hooks_riverpod) | 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`: ```dart @riverpod Future boredSuggestion(BoredSuggestionRef ref) async { final response = await http.get( Uri.https('https://boredapi.com/api/activity'), ); final json = jsonDecode(response.body); return json['activity']! as String; } ``` - Listen to the network request in your UI and gracefully handle loading/error states. ```dart class Home extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final boredSuggestion = ref.watch(boredSuggestionProvider); // Perform a switch-case on the result to handle loading/error states return boredSuggestion.when( loading: () => Text('loading'), error: (error, stackTrace) => Text('error: $error'), data: (data) => Text(data), ); } } ``` See the [FAQ](#FAQ) if you have questions about what this means for [provider]. ## 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 - Fix typos/grammar mistakes - Update the documentation / add examples - Implement new features by making a pull-request ## Sponsors

[provider]: https://github.com/rrousselGit/provider [riverpod]: https://github.com/rrousselGit/riverpod [flutter_hooks]: https://github.com/rrousselGit/flutter_hooks [inheritedwidget]: https://api.flutter.dev/flutter/widgets/InheritedWidget-class.html [hooks_riverpod]: https://pub.dev/packages/hooks_riverpod [flutter_riverpod]: https://pub.dev/packages/flutter_riverpod