StreamCompleter< T> class
A single-subscription stream where the contents are provided later.
It is generally recommended that you never create a Future<Stream>
because you can just directly create a stream that doesn't do anything
until it's ready to do so.
This class can be used to create such a stream.
The stream is a normal stream that you can listen to immediately, but until either setSourceStream or setEmpty is called, the stream won't produce any events.
The same effect can be achieved by using a StreamController
and adding the stream using addStream
when both
the controller's stream is listened to and the source stream is ready.
This class attempts to shortcut some of the overhead when possible.
For example, if the stream is only listened to
after the source stream has been set,
the listen is performed directly on the source stream.
Constructors
Properties
Methods
-
setEmpty(
) → void - Equivalent to setting an empty stream using setSourceStream. [...]
-
setError(
dynamic error, [ StackTrace stackTrace ]) → void -
Completes this to a stream that emits
error
and then closes. [...] -
setSourceStream(
Stream< T> sourceStream) → void - Set a stream as the source of events for the StreamCompleter's stream. [...]
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited
Static Methods
-
fromFuture<
T>( Future< Stream< T>> streamFuture) → Stream< T> -
Convert a
Future<Stream>
to aStream
. [...]