close method

Future<void> close()

Flush all caches and close file handles. Implicitly commits any pending dirty pages.

Implementation

Future<void> close() async {
  if (_closed) return;
  if (_dirty.isNotEmpty) await commit();
  _closed = true;
  final d = _data;
  _data = null;
  if (d != null) {
    try {
      await d.close();
    } catch (_) {/* best-effort */}
  }
  await _closeAndDeleteJournal();
}