Future tick(int times, Interval interval, dynamic action())

Source

static Future tick(int times, Interval interval, action()) async {
  for (var i = 1; i <= times; i++) {
    await new Future.delayed(
        new Duration(milliseconds: interval.inMilliseconds));
    await action();
  }
}