close method

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

Closes the writer and releases any system resources associated with it.

This method first flushes any remaining data in the buffer, then closes the underlying writer. After this method is called, any further attempts to use the writer will result in an IOException.

Implementation

@override
Future<void> close() async {
  if (isClosed) return;

  try {
    await flush();
  } finally {
    await _writer.close();
    await super.close();
  }
}