close method

  1. @override
Future<void> close()

Closes the file; further operations throw StateError.

Implementation

@override
Future<void> close() async {
  if (_closed) return;
  await _tail;
  if (_closed) return;
  if (_metaDirty) {
    await _store.putMany({
      idbMetaKey(path): encodeIdbMeta(_length, chunkSize),
    });
    _metaDirty = false;
  }
  _closed = true;
  _cache.clear();
}