Skip to content

Commit

Permalink
Invalidate the onboardingRepositoryProvider inside the onDispose call…
Browse files Browse the repository at this point in the history
…back of the appStartupProvider
  • Loading branch information
bizz84 committed Jan 22, 2024
1 parent 96a52cb commit 6ad66f3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/src/app_startup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ part 'app_startup.g.dart';

@Riverpod(keepAlive: true)
Future<void> appStartup(AppStartupRef ref) async {
ref.onDispose(() {
// ensure dependent providers are disposed as well
ref.invalidate(onboardingRepositoryProvider);
});
// await for all initialization code to be complete before returning
await Future.wait([
// Firebase init
Expand All @@ -32,10 +36,7 @@ class AppStartupWidget extends ConsumerWidget {
loading: () => const AppStartupLoadingWidget(),
error: (e, st) => AppStartupErrorWidget(
message: e.toString(),
onRetry: () {
ref.invalidate(onboardingRepositoryProvider);
ref.invalidate(appStartupProvider);
},
onRetry: () => ref.invalidate(appStartupProvider),
),
);
}
Expand Down

0 comments on commit 6ad66f3

Please sign in to comment.