diff --git a/lib/data/hive/hive_collection_tom_database.dart b/lib/data/hive/hive_collection_tom_database.dart index cc4ded36cd..c66504e431 100644 --- a/lib/data/hive/hive_collection_tom_database.dart +++ b/lib/data/hive/hive_collection_tom_database.dart @@ -121,7 +121,7 @@ class HiveCollectionToMDatabase { Future clear() async { Logs().w('Delete database and storage key...'); - const FlutterSecureStorage() + await const FlutterSecureStorage() .delete(key: FlutterHiveCollectionsDatabase.cipherStorageKey); await tomConfigurationsBox.clear(); await Hive.deleteFromDisk(); diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index f13b00b509..505ecf9adc 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -107,8 +107,6 @@ class MatrixState extends State with WidgetsBindingObserver { late String currentClientSecret; RequestTokenResponse? currentThreepidCreds; - final hiveCollectionToMDatabase = getIt.get(); - void setActiveClient(Client? cl) { final i = widget.clients.indexWhere((c) => c == cl); if (i != -1) { @@ -191,7 +189,7 @@ class MatrixState extends State with WidgetsBindingObserver { Future logout() async { await client.logout(); - await hiveCollectionToMDatabase.clear(); + getIt.get().clear(); } Client? getClientByName(String name) => @@ -365,7 +363,7 @@ class MatrixState extends State with WidgetsBindingObserver { if (state == LoginState.loggedIn) { navigatorContext?.go('/rooms'); } else { - hiveCollectionToMDatabase.clear(); + getIt.get().clear(); } } });