getBox static method
Retrieves or opens a box for the given environment.
Implementation
static Future<CollectionBox<String>> getBox(String env) async {
if (_hiveBoxCollection == null) {
throw StateError(
'HHiveCore is not initialized. Please call HHiveCore.initialize() first.',
);
}
if (_openedBoxes.containsKey(env)) {
return _openedBoxes[env]!;
}
final box = await _hiveBoxCollection!.openBox<String>(env);
_openedBoxes[env] = box;
return box;
}