times method

void times(
  1. void action()
)

Executes action this times. Equivalent to a for loop.

3.times(() => print('hi')); // hi hi hi

Implementation

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