CompleteTimer constructor

CompleteTimer({
  1. required Duration duration,
  2. required Callback callback,
  3. bool periodic = false,
  4. bool autoStart = true,
})

Creates a new timer

The callback function is invoked after the given duration.

If autoStart sets true timer starts automatically, default to true.

If periodic sets true The callback is invoked repeatedly with duration intervals until canceled with the cancel function. Defaults to false

Implementation

factory CompleteTimer({
  required Duration duration,
  required Callback callback,
  bool periodic = false,
  bool autoStart = true,
}) {
  final CompleteTimerOptions options = CompleteTimerOptions(
      callback: callback, duration: duration, autoStart: autoStart);
  if (periodic) {
    return PeriodicTimer(options);
  } else {
    return ResumableTimer(options);
  }
}