Rewrite AsyncValue without Freezed (#670)

This commit is contained in:
Remi Rousselet
2021-08-21 14:38:24 +01:00
committed by GitHub
parent da2f6e5bc2
commit 61809d282a
43 changed files with 1953 additions and 591 deletions

View File

@ -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(