dart:io
Stdout class
An IOSink connected to either the standard out or error of the process.
Provides a blocking IOSink, so using it 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 that 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
-
Properties
- done → Future
read-only, inherited
- A future that will complete when the consumer closes, or when an error occurs.
- encoding ↔ Encoding
read / write, inherited
- The Encoding used when writing strings.
- hashCode → int
read-only, inherited
- The hash code for this object.
- hasTerminal → bool
read-only
- Whether there is a terminal attached to stdout.
- nonBlocking → IOSink
read-only
- A non-blocking
IOSink for the same output. - runtimeType → Type
read-only, inherited
- A representation of the runtime type of the object.
- supportsAnsiEscapes → bool
read-only
- Whether connected to a terminal that supports ANSI escape sequences.
- terminalColumns → int
read-only
- The number of columns of the terminal.
- terminalLines → int
read-only
- The number of lines of the terminal.
Methods
- add(List<int> data) → void
inherited
- Adds byte
data to the target consumer, ignoring encoding. - addError(Object error, [StackTrace? stackTrace]) → void
inherited
- Passes the error to the target consumer as an error event.
- addStream(Stream<List<int>> stream) → Future
inherited
- Adds all elements of the given
stream. - close() → Future
inherited
- Close the target consumer.
- flush() → Future
inherited
- Returns a Future that completes once all buffered data is accepted by the underlying StreamConsumer.
- noSuchMethod(Invocation invocation) → dynamic
inherited
- Invoked when a non-existent method or property is accessed.
- toString() → String
inherited
- A string representation of this object.
- write(Object? object) → void
inherited
- Converts
object to a String by invoking Object.toString and adds the encoding of the result to the target consumer. - writeAll(Iterable objects, [String sep = ""]) → void
inherited
- Iterates over the given
objects and writes them in sequence. - writeCharCode(int charCode) → void
inherited
- Writes the character of
charCode. - writeln([Object? object = ""]) → void
inherited
- Converts
object to a String by invoking Object.toString and writes the result to this, followed by a newline.
Operators
- operator ==(Object other) → bool
inherited
- The equality operator.