mapSequential<A, B> function

Future<List<B>> mapSequential<A, B>(
  1. Iterable<A> items,
  2. Future<B> fn(
    1. A
    )
)

Sequential async map (one after another). Roadmap #181.

Implementation

Future<List<B>> mapSequential<A, B>(Iterable<A> items, Future<B> Function(A) fn) async {
  final List<B> out = <B>[];
  for (final A item in items) {
    out.add(await fn(item));
  }
  return out;
}