# close method

1. @override

Future<void> close()
override

Closes this output stream and releases any system resources associated with this stream.

A closed stream cannot perform output operations and cannot be reopened. The close method of OutputStream calls flush before closing the stream.

## Example

    final output = FileOutputStream('output.txt');
    try {
      await output.writeString('Hello, World!');
      // flush() is called automatically by close()
    } finally {
      await output.close(); // Always close in finally block
    }

Throws IOException if an I/O error occurs.

## Implementation

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

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