applyForIndexed<T> method

T applyForIndexed<T>(
  1. int n,
  2. T task(
    1. T v,
    2. int i
    )
)

Repeat the task with T as parameter for n times

Implementation

T applyForIndexed<T>(int n, T Function(T v, int i) task) {
  T value = this as T;
  n.repeatsForIndexed((i) => value = task(value, i));
  return value;
}