times function

void times(
  1. int n,
  2. dynamic callback(
    1. int i
    )
)

Do the callback n times, argument increases

Implementation

void times(int n, Function(int i) callback) {
  for (var i = 0; i < n; i++) {
    callback(i);
  }
}