notifyListeners method

void notifyListeners()

Call all the registered listeners.

Subclasses should call this method whenever the object changes in a way that requires notifying listeners.

If a listener is added or removed during this method, the change will not affect the current notification.

Implementation

void notifyListeners() {
  // Create a copy to avoid concurrent modification issues
  final List<Function()> localListeners = List.from(_listeners);

  for (final Function() listener in localListeners) {
    listener();
  }
}