mapAsStream<V> function

Stream<V> mapAsStream<V>(
  1. Iterable<V> source,
  2. Future<V> forEach(
    1. V elemente
    ), [
  3. int parallels = 1
])

Iterable elements of source with support async and emits each forEach async end

Implementation

Stream<V> mapAsStream<V>(
    Iterable<V> source, Future<V> Function(V elemente) forEach,
    [int parallels = 1]) async* {
  for (final Iterable<V> group in groupBySize<V>(source, parallels)) {
    for (final V result in (await Future.wait(group.map(forEach)))) {
      yield result;
    }
  }
}