mirror of
https://github.com/rrousselGit/riverpod.git
synced 2025-08-14 17:41:48 +08:00
Rewrite AsyncValue without Freezed (#670)
This commit is contained in:
@ -120,7 +120,7 @@ class MyHomePage extends HookConsumerWidget {
|
||||
final count = ref.watch(questionsCountProvider);
|
||||
|
||||
return count.when(
|
||||
loading: () => const Center(
|
||||
loading: (_) => const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
error: (err, stack) {
|
||||
@ -178,11 +178,11 @@ class QuestionItem extends HookConsumerWidget {
|
||||
final question = ref.watch(currentQuestion);
|
||||
final questionTheme = ref.watch(questionThemeProvider);
|
||||
|
||||
if (question.data == null) {
|
||||
if (question is AsyncLoading) {
|
||||
return const Center(child: Text('loading'));
|
||||
}
|
||||
|
||||
final data = question.data!.value;
|
||||
final data = question.value;
|
||||
|
||||
return ListTile(
|
||||
title: Text(
|
||||
|
Reference in New Issue
Block a user