periodic method

Timer periodic(
  1. int milliSeconds,
  2. void callback(
    1. Timer timer
    )
)

定时 @params milliSeconds 每多少毫秒执行回调一次

Implementation

Timer periodic(int milliSeconds, void Function(Timer timer) callback) {
  final timer = Timer.periodic(milliSeconds.toMilliSeconds, (t) {
    if (mounted) {
      callback(t);
    }
  });
  _addTimerSubscription(timer);
  return timer;
}