disposeOnce method

  1. @override
Future<void> disposeOnce()
override

Implementation

@override
Future<void> disposeOnce() async {
  final box = _box;
  _box = null;
  if (box == null) return;
  final remaining = (_openCounts[boxName] ?? 1) - 1;
  if (remaining > 0) {
    _openCounts[boxName] = remaining;
    return;
  }
  _openCounts.remove(boxName);
  await box.close();
}