cancel method

void cancel()

销毁计时器

Implementation

void cancel() {
  if (timer != null) {
    timer?.cancel();
    timer = null;
  }
}