ValueStream<T> class
abstract
Abstract base class for a broadcast Stream with access to the latest emitted value.
- Implemented types
-
- Sink<
T>
- Sink<
Constructors
- ValueStream([T? initialValue])
Properties
-
first
→ Future<
T> -
The first element of this stream.
Returns last emitted value if available, or waits for the first element to come.
May throw, if first value is an error.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
innerStream
→ Stream<
T> -
Internal stream.
no setter
- isClosed → bool
-
Whether the stream is closed for adding more events.
no setter
-
next
→ Future<
T> -
Waits for the next element emitted by this stream, and returns it.
If the stream emits an error, it will be propagated to the returned future.
If the stream is closed before any data is emitted, it will throw a StateError.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- valueOrNull → T?
-
Latest emitted value, or null if no value is available.
no setter
Methods
-
add(
T data, {bool skipIfClosed = false, bool skipSame = false, bool skipNull = false}) → bool -
Push
datato the stream. Ignored ifskipIfClosedis true and the stream is closed. Ignored ifskipSameis true anddata==value. Ignored ifskipNullis true anddatais null. Return true ifvaluewas added.override -
close(
) → Future< void> -
Close the stream. After that, calls to add are no longer allowed.
override
-
listen(
void onData(T data)?, {void onDone()?}) → StreamSubscription< T> - Adds a subscription to this stream.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited