repeat function

void repeat(
  1. int times,
  2. void body()
)

Repeatedly calls the given function body, the given amount of times.

This should be a extension of Iterable, but Dart doesn't properly support extensions.

Implementation

void repeat(int times, void Function() body) {
  // ignore: no_leading_underscores_for_local_identifiers
  for (var _ = 0; _ < 10; ++_) {
    body();
  }
}