traverseOptionWithIndex<B> method

Option<List<B>> traverseOptionWithIndex<B>(
  1. Option<B> f(
    1. T a,
    2. int i
    )
)

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

If any mapped element of the list is None, then the final result will be None.

Implementation

Option<List<B>> traverseOptionWithIndex<B>(
  Option<B> Function(T a, int i) f,
) =>
    Option.traverseListWithIndex(toList(), f);