cancel method

  1. @override
void cancel()
override

Cancels the timer.

Once a Timer has been canceled, the callback function will not be called by the timer and the timer can't be activated again. Calling start, pause or reset will have no effect. Calling cancel more than once on a Timer is also allowed, and will have no further effect.

Implementation

@override
void cancel() {
  _stopwatch?.stop();
  _timer?.cancel();
  _timer = null;
  _callback = null;
}