IOSink class

A combined byte and text output.

An IOSink combines a StreamSink of bytes with a StringSink, and allows easy output of both bytes and text.

Writing text (write) and adding bytes (add) may be interleaved freely.

While a stream is being added using addStream, any further attempts to add or write to the IOSink will fail until the addStream completes.

It is an error to add data to the IOSink after the sink is closed.

Implemented types
Implementers

Constructors

IOSink(StreamConsumer<List<int>> target, {Encoding encoding = utf8})
factory
Create an IOSink that outputs to a target StreamConsumer of bytes. [...]

Properties

doneFuture
read-only, override
A future that will complete when the consumer closes, or when an error occurs. [...]
encodingEncoding
read / write
The Encoding used when writing strings. [...]
hashCodeint
read-only, inherited
The hash code for this object. [...]
runtimeTypeType
read-only, inherited
A representation of the runtime type of the object.

Methods

add(List<int> data) → void
override
Adds byte data to the target consumer, ignoring encoding. [...]
addError(Object error, [StackTrace? stackTrace]) → void
override
Passes the error to the target consumer as an error event. [...]
addStream(Stream<List<int>> stream) → Future
override
Adds all elements of the given stream. [...]
close() → Future
override
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
inherited
Invoked when a non-existent method or property is accessed. [...]
toString() → String
inherited
A string representation of this object. [...]
write(Object? object) → void
override
Converts object to a String by invoking Object.toString and adds the encoding of the result to the target consumer. [...]
writeAll(Iterable objects, [String separator = ""]) → void
override
Iterates over the given objects and writes them in sequence. [...]
writeCharCode(int charCode) → void
override
Writes the character of charCode. [...]
writeln([Object? object = ""]) → void
override
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. [...]

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-io/IOSink-class.html