IListConcurrencyOps<A>
extensionIListConcurrencyOps<A>onIList<A>
Concurrency operations on IList using bounded parallelism.
Methods
parTraverseION() extension
Maps f over the list concurrently, running at most n tasks at a time.
Available on IList<A>, provided by the IListConcurrencyOps<A> extension
Implementation
dart
IO<IList<B>> parTraverseION<B>(int n, IO<B> Function(A) f) {
if (n <= 0) throw ArgumentError("Concurrency limit 'n' must be > 0");
return Semaphore.permits(
n,
).flatMap((sem) => parTraverseIO((a) => sem.permit().use((_) => f(a))));
}