cancel method

bool cancel()

Cancels any pending wait. Returns true if a wait was actually cancelled, false if there was nothing pending.

Implementation

bool cancel() {
  final timer = _timer;
  if (timer == null) return false;
  final wasActive = timer.isActive;
  timer.cancel();
  _timer = null;
  return wasActive;
}