dispose method

  1. @mustCallSuper
void dispose()

Implementation

@mustCallSuper
void dispose() {
  assert(Notifier.debugAssertNotDisposed(this));
  assert(
    _notificationCallStackDepth == 0,
    'The "dispose()" method on $this was called during the call to '
    '"refresh()". This is likely to cause errors since it modifies '
    'the list of listeners while the list is being used.',
  );
  assert(() {
    _debugDisposed = true;
    return true;
  }());
  if (kFlutterMemoryAllocationsEnabled && _creationDispatched) {
    FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
  }
  _listeners = _emptyListeners;
  _count = 0;
}