flutter_riverpod
リアクティブなキャッシュおよびデータバインディングフレームワーク。Riverpod は非同期コードの扱いを簡単にする。
リアクティブなキャッシュおよびデータバインディングフレームワーク。Riverpod は非同期コードの扱いを簡単にします。
リアクティブなキャッシュおよびデータバインディングフレームワーク。Riverpod は非同期コードの扱いを簡単にする。
リアクティブなキャッシュおよびデータバインディングフレームワーク。Riverpod は非同期コードの扱いを簡単にする。
リアクティブなキャッシュおよびデータバインディングフレームワーク。Riverpod は非同期コードの扱いを簡単にする。
riverpod_generator 用のアノテーションを公開するパッケージ
Riverpod用のコードジェネレーターです。構文を簡略化し、状態付きホットリロードなどの機能を強化します。
以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
https://raw.githubusercontent.com/rrousselGit/riverpod/master/resources/flutter_favorite.png Build Status codecov Star on Github License: MIT Discord
Riverpod
A reactive caching and data-binding framework. https://riverpod.dev Riverpod makes working with asynchronous code a breeze by:
| riverpod | pub package |
|---|---|
| flutter_riverpod | pub package |
| hooks_riverpod | pub 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:
@riverpod
Future<String> boredSuggestion(Ref ref) async {
final response = await http.get(
Uri.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.
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 switch (boredSuggestion) {
AsyncData(:final value) => Text('data: $value'),
AsyncError(:final error) => Text('error: $error'),
_ => const Text('loading'),
};
}
}
Contributions are welcome!
Here is a curated list of how you can help:
https://raw.githubusercontent.com/rrousselGit/freezed/master/sponsorkit/sponsors.svg