openBox method
Implementation
Future<void> openBox(String boxName, {List<int>? hiveSecret}) async {
_boxName = boxName;
if (_isLazy) {
if (hiveSecret != null) {
await Hive.openLazyBox(_boxName,
encryptionCipher: HiveAesCipher(hiveSecret));
} else {
await Hive.openLazyBox(boxName);
}
} else {
if (hiveSecret != null) {
await Hive.openBox(_boxName,
encryptionCipher: HiveAesCipher(hiveSecret));
} else {
await Hive.openBox(boxName);
}
}
if (getBox().isOpen) {
_logger.finer('$boxName initialized successfully');
} else {
_logger.shout('$boxName was apparently initialized, but is not open');
}
}