notifyListeners method

void notifyListeners()

Notify all registered listeners.

Implementation

void notifyListeners() {
  throwIfDisposed();
  if (_listenerCount == 0) {
    return;
  }
  _notificationDepth += 1;
  final end = _listeners.length;
  try {
    for (var i = 0; i < end; i++) {
      _listeners[i]?.call();
    }
  } finally {
    _notificationDepth -= 1;
    if (_notificationDepth == 0 && _needsCompaction) {
      _listeners.removeWhere((listener) => listener == null);
      _needsCompaction = false;
    }
  }
}