dispose method

  1. @mustCallSuper
void dispose ()
@mustCallSuper

Release the resources used by this object. The object is no longer usable after this method is called.

Implementation

@mustCallSuper
void dispose() {
  if (_future != null) {
    final TickerFuture localFuture = _future;
    _future = null;
    assert(!isActive);
    unscheduleTick();
    localFuture._cancel(this);
  }
  assert(() {
    // We intentionally don't null out _startTime. This means that if start()
    // was ever called, the object is now in a bogus state. This weakly helps
    // catch cases of use-after-dispose.
    _startTime = Duration.zero;
    return true;
  }());
}