closeAll static method

Future<void> closeAll()

Saves and closes every open box (mostly useful in tests).

Implementation

static Future<void> closeAll() async {
  final boxes = _openBoxes.values.toList();
  final lazy = _openLazy.values.toList();
  _openBoxes.clear();
  _openLazy.clear();
  await Future.wait([
    ...boxes.map((b) => b.close()),
    ...lazy.map((b) => b.close()),
  ]);
}