applyFor<T> method

T applyFor<T>(
  1. int n,
  2. T task(
    1. T
    )
)

Repeat the task with T as parameter for n times

Implementation

T applyFor<T>(int n, T Function(T) task) {
  T value = this as T;
  n.repeatsFor(() => value = task(value));
  return value;
}