StreamSink<S> class

A object that accepts stream events both synchronously and asynchronously.

A StreamSink combines the methods from StreamConsumer and EventSink.

The EventSink methods can't be used while the addStream is called. As soon as the addStream's Future completes with a value, the EventSink methods can be used again.

If addStream is called after any of the EventSink methods, it'll be delayed until the underlying system has consumed the data added by the EventSink methods.

When EventSink methods are used, the done Future can be used to catch any errors.

When close is called, it will return the done Future.

Implemented types
Implementers

Constructors

StreamSink()

Properties

doneFuture
read-only
Return a future which is completed when the StreamSink is finished. [...]
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(S event) → void
inherited
Adds a data event to the sink. [...]
addError(Object error, [StackTrace? stackTrace]) → void
inherited
Adds an error to the sink. [...]
addStream(Stream<S> stream) → Future
inherited
Consumes the elements of stream. [...]
close() → Future
override
Tells the stream sink that no further streams will be added. [...]
noSuchMethod(Invocation invocation) → dynamic
inherited
Invoked when a non-existent method or property is accessed. [...]
toString() → String
inherited
A string representation of this object. [...]

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-async/StreamSink-class.html