closeResourceBoxes method

Future<void> closeResourceBoxes({
  1. required List<R4ResourceType> types,
  2. String? pw,
})

Specify a list of which boxes you want to close

Implementation

Future<void> closeResourceBoxes({
  required List<R4ResourceType> types,
  String? pw,
}) async {
  await _ensureInit(pw: pw);
  for (final R4ResourceType resourceType in types) {
    final String resourceTypeString =
        Resource.resourceTypeToString(resourceType);
    if (!Hive.isBoxOpen(resourceTypeString)) {
      await Hive.box(resourceTypeString).close();
    }
  }
}