times method

void times(
  1. void action(
    1. int index
    )
)

Repeats action this many times, passing the index (0-based).

Implementation

void times(void Function(int index) action) {
  for (int i = 0; i < this; i++) {
    action(i);
  }
}