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
- isNotEmpty → bool
-
Available on ValueStream<
Iterable< , provided by the ValueStreamIterableExtensions extensionX> >no setter - isUnique → bool
-
final
-
keys
→ ValueStream<
Iterable< K> > -
Available on ValueStream<
Map< , provided by the ValueStreamOfMapExtensions extensionK, V> >no setter - length → int
-
Available on ValueStream<
Iterable< , provided by the ValueStreamIterableExtensions extensionX> >no setter - 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
-
values
→ ValueStream<
Iterable< V> > -
Available on ValueStream<
Map< , provided by the ValueStreamOfMapExtensions extensionK, V> >no setter
Methods
-
awaitEach(
) → ValueStream< Future< Iterable< >X> > -
Available on ValueStream<
Iterable< , provided by the ValueStreamIterableFutureExtensions extensionFuture< >X> > -
combined<
R, O> (ValueStream< O> other, R combiner(T? self, O? other)) → ValueStream<R> -
Available on ValueStream<
Combines another stream.T> , provided by the ValueStreamExtensions extension -
combinedUnresolved<
R, O> (ValueStream< O> other, Resolvable<R?> combiner(FutureOr<T?> self, FutureOr<O?> other)) → ValueStream<R?> -
Available on ValueStream<
Combines another stream, passing unresolved FuturesT> , provided by the ValueStreamExtensions extension -
combineWith(
Iterable< ValueStream< others, [String? debugName]) → ValueStream<Iterable< >X> >Iterable< X> > -
Available on ValueStream<
Iterable< , provided by the ValueStreamIterableExtensions extensionX> > -
debounced(
[Duration? duration]) → ValueStream< T> -
Available on ValueStream<
T> , provided by the ValueStreamExtensions extension -
dispose(
) → Future -
disposeAll(
) → Future -
inherited
-
expandEach<
R> (Iterable< R> expander(X input)) → ValueStream<Iterable< R> > -
Available on ValueStream<
Iterable< , provided by the ValueStreamIterableExtensions extensionX> > -
filteredBy<
R> (ValueStream< R> other, bool filter(X item, R? other)) → ValueStream<Iterable< X> > -
Available on ValueStream<
Filters this stream using a result of another stream. This allows us to apply the filter when either the filtering source changes or the original list changes.Iterable< , provided by the ValueStreamIterableExtensions extensionX> > -
filterEntries(
bool predicate(K key, V value)) → ValueStream< Map< K, V> > -
Available on ValueStream<
Map< , provided by the ValueStreamOfMapExtensions extensionK, V> > -
filterItems(
bool predicate(X input)?) → ValueStream< Iterable< X> > -
Available on ValueStream<
Iterable< , provided by the ValueStreamIterableExtensions extensionX> > -
flatten(
[T? initialValue, bool filterNotNull = true]) → Stream< T?> -
Available on ValueStream<
T> , provided by the ValueStreamExtensions extension -
followedBy(
ValueStream< Iterable< other) → ValueStream<X> >Iterable< X> > -
Available on ValueStream<
Iterable< , provided by the ValueStreamIterableExtensions extensionX> > -
get(
) → FutureOr< T?> -
override
-
listen(
void onData(T item)) → StreamSubscription -
Available on ValueStream<
T> , provided by the ValueStreamExtensions extension -
map<
R> (R mapper(T? input)) → ValueStream< R> -
Basics of converting something over
override
-
mapEach<
R> (R mapper(X input)) → ValueStream< Iterable< R> > -
Available on ValueStream<
Iterable< , provided by the ValueStreamIterableExtensions extensionX> > -
mapEntries<
R> (MapEntry< K, R> mapper(K key, V value)) → ValueStream<Map< K, R> > -
Available on ValueStream<
Map< , provided by the ValueStreamOfMapExtensions extensionK, V> > -
mapValues<
R> (R mapper(K key, V value)) → ValueStream< Map< K, R> > -
Available on ValueStream<
Map< , provided by the ValueStreamOfMapExtensions extensionK, V> > -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
peek(
void peek(T item)) → ValueStream< T> -
Available on ValueStream<
T> , provided by the ValueStreamExtensions extension -
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
-
sampled(
) → ValueStream< X?> -
Available on ValueStream<
Future< , provided by the ValueStreamFutureExtensions extensionX> > -
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
-
thenMap<
R> (R mapper(X input)) → ValueStream< Future< R> > -
Available on ValueStream<
Future< , provided by the ValueStreamFutureExtensions extensionX> > -
thenMapEach<
R> (R mapper(X input)) → ValueStream< Iterable< Future< >R> > -
Available on ValueStream<
Iterable< , provided by the ValueStreamIterableFutureExtensions extensionFuture< >X> > -
toMap(
) → ValueStream< Map< K, V> > -
Available on ValueStream<
Iterable< , provided by the ValueStreamIterableMapEntryExtensions extensionMapEntry< >K, V> > -
toString(
) → String -
A string representation of this object.
inherited
-
toSyncStream(
[void onChange(T value)?, String? name]) → SyncStream< T> -
Available on ValueStream<
T> , provided by the ValueStreamExtensions extension -
update(
Producer< T> current, {String? debugLabel, Duration? timeout, bool? fallbackToCurrent}) → Future<T?> -
where(
Predicate< T?> predicate) → ValueStream<T> -
Available on ValueStream<
Filters the entire stream, including the current elementT> , provided by the ValueStreamExtensions extension -
whereNotNull(
) → ValueStream< T> -
Available on ValueStream<
T> , provided by the ValueStreamExtensions extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited