dispose static method
Flushes and closes boxes for the given environment.
Implementation
static Future<void> dispose(String env) async {
if (_hiveBoxCollection == null) {
return;
}
final store = await getBox(env);
await store.flush();
if (_openedBoxes.containsKey(env)) {
_openedBoxes.remove(env);
}
final metaStore = await getMetaBox(env);
if (metaStore != null) {
await metaStore.flush();
final metaBoxName = '_meta_$env';
if (_openedBoxes.containsKey(metaBoxName)) {
_openedBoxes.remove(metaBoxName);
}
}
}