DataStream<T> class

A broadcast Stream with access to the latest emitted value. Does explicitly NOT handle errors to provide a direct and simple access to the value.

Inheritance

Constructors

DataStream(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.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
innerStream Stream<T>
Internal stream.
no setterinherited
isClosed bool
Whether the stream is closed for adding more events.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T
Latest emitted value.
no setter
valueOrNull → T
Latest emitted value, or null if no value is available.
no setteroverride

Methods

add(T data, {bool skipIfClosed = false, bool skipSame = false, bool skipNull = false}) bool
Push data to the stream. Ignored if skipIfClosed is true and the stream is closed. Ignored if skipSame is true and data == value. Ignored if skipNull is true and data is null. Return true if value was added.
inherited
close() Future<void>
Close the stream. After that, calls to add are no longer allowed.
inherited
listen(void onData(T data)?, {void onDone()?}) StreamSubscription<T>
Adds a subscription to this stream.
override
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