close method

Future<void> close()

Close all databases and reset state.

Implementation

Future<void> close() async {
  if (_persistentDatabase != null) {
    await _persistentDatabase!.close();
    _persistentDatabase = null;
  }
  // Close all heavy cache databases
  for (final db in _heavyDatabases.values) {
    await db.close();
  }
  _heavyDatabases.clear();
  if (_inMemoryDatabase != null) {
    await _inMemoryDatabase!.close();
    _inMemoryDatabase = null;
  }
}