traverseListSeq<A, B> static method

TaskOption<List<B>> traverseListSeq<A, B>(
  1. List<A> list,
  2. TaskOption<B> f(
    1. A a
    )
)

Map each element in the list to a TaskOption using the function f, and collect the result in an TaskOption<List<B>>.

Each TaskOption is executed in sequence. This strategy takes more time than parallel, but it ensures that all the request are executed in order.

If you need TaskOption to be executed in parallel, use traverseListWithIndex.

Same as TaskOption.traverseListWithIndexSeq but without index in the map function.

Implementation

static TaskOption<List<B>> traverseListSeq<A, B>(
  List<A> list,
  TaskOption<B> Function(A a) f,
) =>
    traverseListWithIndexSeq<A, B>(list, (a, _) => f(a));