utils/async/async library
Classes
- AsyncUpdateScheduler
- An utility class for notifying ~once per VM turn to do an update action.
-
DisposableFuture<
T> -
A future that is
disposable
, which cancels the underlying operation, if any. Even if the operation finishes, then will not be fired if dispose is called first. -
EmptySimpleStream<
T> - An Empty stream that does not support any listeners but pretends to be listening.
-
LastStateStream<
T> - A stream that will provide the last item that was added to the stream to any new subscribers in addition to any new items.
-
LazyStreamController<
T> - An implementation of StreamController that only actually creates the underlying StreamController when the stream getter is called for the first time.
-
PriorityStreamIterator<
T extends Comparable< Object> > - A StreamIterator that accumulates the Stream's values into a priority queue and selects the one with the most priority (the least one by comparison) of all accumulated values at each moveNext call.
-
SimpleEmitter<
T> - Provides an interface for both StreamController and Stream for use with output events in Angular components.
-
SimpleStream<
T> - A ListenOnly Implementation of a Stream. It only supports the listen method with the onData parameter. Additionally, the streamsubscription can only be cancelled. This also acts like a StreamController via the add method.
-
SimpleStreamSubscription<
T> - A SimpleStream implementation of StreamSubscription.
-
ZonedFuture<
T> -
A wrapper around an existing Future that processes all events received
within a specific zone, instead of the default behavior of processing them
in the zone that the
then
originated. -
ZonedStream<
T> -
A wrapper around an existing Stream that processes all events received
within a specific zone, instead of the default behavior of processing them
in the zone that the
listen
originated.
Functions
-
asyncFirst<
T> (List< T> items, Future<bool> filter(T item), {T orElse()?}) → Future<T> -
Returns a future that completes with the first item in
items
for whichfilter
returns a future that completes with true. It completes with an item only when its filter future completes with true AND the filter futures for all previous items have completed. If all filter futures complete with false andorElse
is absent, completes with an error. If all filter futures complete with false andorElse
is present, completes with the return value oforElse
. -
asyncSingle<
T> (List< T> items, Future<bool> filter(T item)) → Future<T> -
Returns a future that completes with the unique item in
items
for whichfilter
returns a future that completes with true. It completes with an item only when its filter future completes with true AND all the other filter futures complete with false. If all filter futures complete with false or (at least 2 complete with true and all the ones before them complete), then it completes with an error. -
asyncWhere<
T> (List< T> items, Future<bool> filter(T item)) → Stream<T> -
Returns a single-subscription stream of the
items
for which thefilter
returns a future that completes with true. The stream fires an event for an item only when its future completes with true AND the filter futures for all previous items have completed. -
debounceStream<
S, T> (Duration duration) → StreamTransformer< S, T> -
Debounces a stream, preventing it from triggering until
duration
has passed between events. -
throttleStream<
S, T> (Duration duration, {bool guaranteeLast = true}) → StreamTransformer< S, T> -
Throttles a stream, triggering events at most once per
duration
.
Typedefs
- OnUpdateCallback = void Function()
-
A callback registered with
AsyncNotifier
. - RunInZoneFn = dynamic Function(dynamic fn())
-
Runs
fn
within a zone. -
StreamCallbackFunc<
T> = void Function(T value) - StreamCallContextFunc = void Function(dynamic func())
-
StreamControllerFactory<
T> = StreamController< T> Function() - Creates a stream controller.
-
SubscriptionChangeListener<
T> = void Function(StreamSubscription< T> subscription)