Source
static Timer every(interval, action()) { Duration duration; if (interval is Duration) { duration = interval; } else if (interval is int) { duration = new Duration(milliseconds: interval); } else if (interval is Interval) { duration = interval.duration; } else { throw new Exception("Invalid Interval: ${interval}"); } return new Timer.periodic(duration, (timer) async { await runZoned(action, zoneValues: {"dslink.scheduler.timer": timer}); }); }