dispose method

  1. @mustCallSuper
void dispose()

Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).

This method should only be called by the object's owner.

Implementation

@mustCallSuper
void dispose() {
  assert(_debugAssertNotDisposed());
  assert(() {
    _debugDisposed = true;
    return true;
  }());
  _listeners = _emptyListeners;
  _count = 0;
}