close method
Closes this input stream and releases any system resources associated with the stream.
The close method of InputStream does nothing. Subclasses should override this method to release resources.
Example
final input = FileInputStream('data.txt');
try {
// Use the input stream
final data = await input.readAll();
processData(data);
} finally {
await input.close(); // Always close in finally block
}
Throws IOException if an I/O error occurs.
Implementation
@override
@mustCallSuper
Future<void> close() async {
_closed = true;
}