notifyStatusListeners method

  1. @protected
void notifyStatusListeners(
  1. AnimationStatus status
)

Calls all the status listeners.

If listeners are added or removed during this function, the modifications will not change which listeners are called during this iteration.

Implementation

@protected
@pragma('vm:notify-debugger-on-exception')
void notifyStatusListeners(AnimationStatus status) {
  final List<AnimationStatusListener> localListeners = _statusListeners.toList(growable: false);
  for (final AnimationStatusListener listener in localListeners) {
    try {
      if (_statusListeners.contains(listener)) {
        listener(status);
      }
    } catch (exception, stack) {
      InformationCollector? collector;
      assert(() {
        collector = () => <DiagnosticsNode>[
          DiagnosticsProperty<AnimationLocalStatusListenersMixin>(
            'The $runtimeType notifying status listeners was',
            this,
            style: DiagnosticsTreeStyle.errorProperty,
          ),
        ];
        return true;
      }());
      FlutterError.reportError(FlutterErrorDetails(
        exception: exception,
        stack: stack,
        library: 'animation library',
        context: ErrorDescription('while notifying status listeners for $runtimeType'),
        informationCollector: collector,
      ));
    }
  }
}