StreamWithLatestValue<T> class
StreamWithValue implementation that wraps a Stream and keeps the latest value that was received from it. Beware that for "push" model, where a (typically broadcast) stream pushes data even when it's not listened to, the value will not be tracked if there are no listeners on updates. In such case PushStreamWithValue may be more appropriate.
- Implemented types
- Available Extensions
Constructors
-
StreamWithLatestValue(Stream<
T> sourceStream) -
StreamWithLatestValue.withInitialValue(Stream<
T> sourceStream, {required T initialValue}) -
Set value to
initialValue
and flip loaded totrue
upon construction.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- loaded → bool
-
Whether it's safe to access value (i.e. it is initialized).
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
updates
→ Stream<
T> -
Any changes to value, in the form of a stream.
The current value itself typically is not sent upon Stream.listen to
updates, although this detail is implementation defined.
no setteroverride
- value → T
-
Must check loaded before attempting to read value. If the value is
not initialized (either through withInitialValue or stream event), an
exception will be thrown.
no setteroverride
Methods
-
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