diff --git a/lib/main.dart b/lib/main.dart index 31c1da57..01e418dd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -70,7 +70,6 @@ Future main(List rawArgs) async { } await KVStoreService.initialize(); - KVStoreService.doneGettingStarted = false; final hiveCacheDir = kIsWeb ? null : (await getApplicationSupportDirectory()).path; diff --git a/lib/pages/getting_started/sections/support.dart b/lib/pages/getting_started/sections/support.dart index 1be7ca34..46823425 100644 --- a/lib/pages/getting_started/sections/support.dart +++ b/lib/pages/getting_started/sections/support.dart @@ -101,9 +101,11 @@ class GettingStartedScreenSupportSection extends HookConsumerWidget { style: TextButton.styleFrom( foregroundColor: Colors.white, ), - onPressed: () { - KVStoreService.doneGettingStarted = true; - context.go("/"); + onPressed: () async { + await KVStoreService.setDoneGettingStarted(true); + if (context.mounted) { + context.go("/"); + } }, ), ), @@ -115,9 +117,11 @@ class GettingStartedScreenSupportSection extends HookConsumerWidget { backgroundColor: const Color(0xff1db954), foregroundColor: Colors.white, ), - onPressed: () { - KVStoreService.doneGettingStarted = true; - context.push("/login"); + onPressed: () async { + await KVStoreService.setDoneGettingStarted(true); + if (context.mounted) { + context.push("/login"); + } }, ), ], diff --git a/lib/services/kv_store/kv_store.dart b/lib/services/kv_store/kv_store.dart index 6f6807e0..c1275612 100644 --- a/lib/services/kv_store/kv_store.dart +++ b/lib/services/kv_store/kv_store.dart @@ -10,6 +10,6 @@ abstract class KVStoreService { static bool get doneGettingStarted => sharedPreferences.getBool('doneGettingStarted') ?? false; - static set doneGettingStarted(bool value) => - sharedPreferences.setBool('doneGettingStarted', value); + static Future setDoneGettingStarted(bool value) async => + await sharedPreferences.setBool('doneGettingStarted', value); }