close method

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

Writes out anything still pending and closes the stream, which is what replaces the target file with everything written. Idempotent.

Implementation

@override
Future<void> close() async {
  if (_done) return;
  await _flush();
  _done = true;
  await _stream.close().toDart;
}