AsyncValueStream<T> class
The AsyncValueStream is used as a clearing house when more than one consumer need to update a single value, but you want to control the lifecycle around updates, so that older updates that take longer to calculate don't clobber newer values.
This allows for synchronous or asynchronous updates, but the last update to start will always "win", even if if finishes before another update that started before it.
Updates may be asynchronous, so they are queued up, and then processed in order. The current value is tracked as current
- Implemented types
-
- ValueStream<
T?>
- ValueStream<
- Mixed-in types
- Available extensions
Constructors
- AsyncValueStream({String? debugName, T? initialValue, bool isUnique = true, ClearingHouseMode mode = ClearingHouseMode.AllowSynchronousValues})
Properties
-
after
→ Stream<
T?> -
no setteroverride
- current → T?
-
no setter
- debugName → String
-
The debug name for this stream
final
-
future
→ Future<
T> -
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- isFirstResolved → bool
-
no setteroverride
- isUnique → bool
-
final
- log → Logger
-
Our logger
final
- mode → ClearingHouseMode
-
How updates are locked.
final
-
nextUpdate
→ Future<
T> -
Waits until the next update completes
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → Future -
disposeAll(
) → Future -
inherited
-
get(
) → FutureOr< T?> -
override
-
map<
R> (R mapper(T? input)) → ValueStream< R> -
Basics of converting something over
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerDisposer(
Disposer callback) → void -
inherited
-
registerStream(
Stream? stream) → void -
inherited
-
registerSubscription(
StreamSubscription? subscription) → void -
inherited
-
removeDisposer(
FutureOr dispose()) → void -
inherited
-
resolve(
[T? ifAbsent]) → T? -
override
-
syncUpdate(
T current) → FutureOr< T> - When setting a value in this way, we can assume that this update is the latest, and should cancel out any other in-flight requests
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
Producer< T> current, {String? debugLabel, Duration? timeout, bool? fallbackToCurrent}) → Future<T?>
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited