Stdout class Null safety

Stdout represents the IOSink for either stdout or stderr.

It provides a blocking IOSink, so using this to write will block until the output is written.

In some situations this blocking behavior is undesirable as it does not provide the same non-blocking behavior as dart:io in general exposes. Use the property nonBlocking to get an IOSink which has the non-blocking behavior.

This class can also be used to check whether stdout or stderr is connected to a terminal and query some terminal properties.

The addError API is inherited from StreamSink and calling it will result in an unhandled asynchronous error unless there is an error handler on done.

Implemented types


done Future
Get a future that will complete when the consumer closes, or when an error occurs. This future is identical to the future returned by close.
read-only, inherited
encoding Encoding
The Encoding used when writing strings. Depending on the underlying consumer this property might be mutable.
read / write, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
hasTerminal bool
Returns true if there is a terminal attached to stdout.
nonBlocking IOSink
Get a non-blocking IOSink.
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
supportsAnsiEscapes bool
Whether connected to a terminal that supports ANSI escape sequences. [...]
terminalColumns int
Get the number of columns of the terminal. [...]
terminalLines int
Get the number of lines of the terminal. [...]


add(List<int> data) → void
Adds byte data to the target consumer, ignoring encoding. [...]
addError(Object error, [StackTrace? stackTrace]) → void
Passes the error to the target consumer as an error event. [...]
addStream(Stream<List<int>> stream) Future
Adds all elements of the given stream to this. [...]
close() Future
Close the target consumer. [...]
flush() Future
Returns a Future that completes once all buffered data is accepted by the underlying StreamConsumer. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
Returns a string representation of this object.
write(Object? object) → void
Converts obj to a String by invoking Object.toString and adds the encoding of the result to the target consumer. [...]
writeAll(Iterable objects, [String sep = ""]) → void
Iterates over the given objects and writes them in sequence. [...]
writeCharCode(int charCode) → void
Writes the character of charCode. [...]
writeln([Object? object = ""]) → void
Converts obj to a String by invoking Object.toString and writes the result to this, followed by a newline. [...]


operator ==(Object other) bool
The equality operator. [...]