foldLeftWithIndex<B> method

B foldLeftWithIndex<B>(
  1. B b,
  2. B f(
    1. int i,
    2. B acc,
    3. A a
    )
)

Implementation

B foldLeftWithIndex<B>(B b, B Function(int i, B acc, A a) f) =>
    foldLeft<Tuple2<B, int>>(
      Tuple2(b, 0),
      (t, a) => Tuple2(f(t.second, t.first, a), t.second + 1),
    ).first;