dispose method

void dispose()

Releases all listeners. After this call the notifier should not be used.

Implementation

void dispose() {
  throwIfDisposed();
  if (_notificationDepth > 0) {
    throw StateError(
      'dispose() cannot be called while notifyListeners() is running.',
    );
  }
  _isDisposed = true;
  _listeners.clear();
  _listenerCount = 0;
  _needsCompaction = false;
}