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.

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

Implementation

@mustCallSuper
void dispose() {
  assert(!_isDisposed, 'This $runtimeType has already been disposed.');
  assert(
    _notificationCallStackDepth == 0,
    'The "dispose()" method on $this was called during a call to "notifyListeners()".',
  );
  _isDisposed = true;
  _listeners = _emptyListeners;
  _count = 0;
  _detachAllFinalizers();
}