AsyncMap<T> extension

Alternatives to asyncMap.

The built in asyncMap will not overlap execution of the passed callback, and every event will be sent to the callback individually.

  • asyncMapBuffer prevents the callback from overlapping execution and collects events while it is executing to process in batches.
  • asyncMapSample prevents overlapping execution and discards events while it is executing.
  • concurrentAsyncMap allows overlap and removes ordering guarantees.


asyncMapBuffer<S>(Future<S> convert(List<T>)) Stream<S>
Like asyncMap but events are buffered until previous events have been processed by convert. [...]
asyncMapSample<S>(Future<S> convert(T)) Stream<S>
Like asyncMap but events are discarded while work is happening in convert. [...]
concurrentAsyncMap<S>(FutureOr<S> convert(T)) Stream<S>
Like asyncMap but the convert callback may be called for an element before processing for the previous element is finished. [...]