IOSinkBase class Null safety

An abstract class that implements dart:io's IOSink's API in terms of onData, onError, onClose, and onFlush methods.

Because IOSink is defined in dart:io, this can't officially implement it. However, it's designed to match its API exactly so that subclasses can implement IOSink without any additional modifications.

This takes care of ensuring that events can't be added after close is called or during a call to onStream.

Inheritance
Available Extensions

Constructors

IOSinkBase([Encoding encoding])

Properties

done Future<void>
Return a future which is completed when the StreamSink is finished. [...]
read-only, inherited
encoding Encoding
See IOSink.encoding from dart:io.
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

add(List<int> data) → void
Adds a data event to the sink. [...]
inherited
addError(Object error, [StackTrace? stackTrace]) → void
Adds an error to the sink. [...]
inherited
addStream(Stream<List<int>> stream) Future<void>
Consumes the elements of stream. [...]
inherited
close() Future<void>
Closes the sink. [...]
inherited
flush() Future<void>
See IOSink.flush from dart:io. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
onAdd(List<int> data) → void
A method that handles data events that are passed to the sink.
onClose() FutureOr<void>
A method that handles the sink being closed. [...]
onError(Object error, [StackTrace? stackTrace]) → void
A method that handles error events that are passed to the sink.
onFlush() Future<void>
Flushes any buffered data to the underlying consumer, and returns a future that completes once the consumer has accepted all data.
toString() String
A string representation of this object. [...]
inherited
write(Object? object) → void
See IOSink.write from dart:io.
writeAll(Iterable<Object?> objects, [String separator = '']) → void
See IOSink.writeAll from dart:io.
writeCharCode(int charCode) → void
See IOSink.writeCharCode from dart:io.
writeln([Object? object = '']) → void
See IOSink.writeln from dart:io.

Operators

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