CustomTimerController constructor

CustomTimerController({
  1. required TickerProvider vsync,
  2. required Duration begin,
  3. required Duration end,
  4. CustomTimerState initialState = CustomTimerState.reset,
  5. CustomTimerInterval interval = CustomTimerInterval.milliseconds,
})

Controls the state of the timer. Allows you to execute the start(), pause(), reset() and finish() functions. It also allows you to get or subscribe to the current state and remaining time. Remember to dispose when you are no longer using it.

Implementation

CustomTimerController({
  required this.vsync,
  required Duration begin,
  required Duration end,
  this.initialState = CustomTimerState.reset,
  this.interval = CustomTimerInterval.milliseconds,
}) {
  _begin = begin;
  _end = end;
  _animationController = AnimationController(vsync: vsync);
  _init();

  if (initialState == CustomTimerState.finished)
    finish();
  else if (initialState == CustomTimerState.counting) start();

  _animation.addListener(_listener);
  _animation.addStatusListener(_statusListener);
}