repeat static method

Future repeat(
  1. int times,
  2. dynamic action()
)

Implementation

static Future repeat(int times, Function() action) async {
  for (var i = 1; i <= times; i++) {
    await action();
  }
}