writeBytes method
Writes all bytes from the specified Uint8List to this output stream.
This is a convenience method for writing binary data efficiently.
Parameters
data
: The binary data to write
Example
final output = FileOutputStream('binary_output.bin');
try {
final binaryData = Uint8List.fromList([0x89, 0x50, 0x4E, 0x47]); // PNG header
await output.writeBytes(binaryData);
await output.flush();
} finally {
await output.close();
}
Throws IOException if an I/O error occurs. Throws StreamClosedException if the stream has been closed.
Implementation
Future<void> writeBytes(Uint8List data) async {
await write(data);
}