diff --git a/lib/features/login/cubit/authentication_cubit.dart b/lib/features/login/cubit/authentication_cubit.dart index 3d9d77a..2afdd1a 100644 --- a/lib/features/login/cubit/authentication_cubit.dart +++ b/lib/features/login/cubit/authentication_cubit.dart @@ -203,10 +203,9 @@ class AuthenticationCubit extends Cubit { Future logout() async { await _resetExternalState(); final globalSettings = Hive.box(HiveBoxes.globalSettings).getValue()!; + globalSettings.currentLoggedInUser = null; + await globalSettings.save(); emit(const AuthenticationState.unauthenticated()); - globalSettings - ..currentLoggedInUser = null - ..save(); } Future _resetExternalState() async { diff --git a/lib/features/settings/view/manage_accounts_page.dart b/lib/features/settings/view/manage_accounts_page.dart index b430d7d..3ba4cb1 100644 --- a/lib/features/settings/view/manage_accounts_page.dart +++ b/lib/features/settings/view/manage_accounts_page.dart @@ -71,11 +71,10 @@ class ManageAccountsPage extends StatelessWidget { ], onSelected: (value) async { if (value == 0) { - await context - .read() - .removeAccount(globalSettings.currentLoggedInUser!); + final currentUser = globalSettings.currentLoggedInUser!; + await context.read().logout(); Navigator.of(context).pop(); - context.read().logout(); + await context.read().removeAccount(currentUser); } }, ),