mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 02:24:30 +00:00
another bandaid fix for hive box isn't open
This commit is contained in:
parent
13e08acf06
commit
36747ca479
1 changed files with 9 additions and 2 deletions
|
@ -274,8 +274,15 @@ class DB {
|
|||
{required dynamic key, required String boxName}) async =>
|
||||
await mutex.protect(() async => await Hive.box<T>(boxName).delete(key));
|
||||
|
||||
Future<void> deleteAll<T>({required String boxName}) async =>
|
||||
await mutex.protect(() async => await Hive.box<T>(boxName).clear());
|
||||
Future<void> deleteAll<T>({required String boxName}) async {
|
||||
await mutex.protect(() async {
|
||||
Box<T> box = Hive.box<T>(boxName);
|
||||
if (!box.isOpen) {
|
||||
box = await Hive.openBox(boxName);
|
||||
}
|
||||
await box.clear();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> deleteBoxFromDisk({required String boxName}) async =>
|
||||
await mutex.protect(() async => await Hive.deleteBoxFromDisk(boxName));
|
||||
|
|
Loading…
Reference in a new issue