notifyListeners method

  1. @protected
void notifyListeners(
  1. int index,
  2. bool selected
)
inherited

Notifies all the registered listeners.

Implementation

@protected
void notifyListeners(int index, bool selected) {
  assert(_debugAssertNotDisposed());
  if (_listeners != null) {
    final allListeners = List<ItemSelectionChangeCallback>.from(
        [..._listeners!, ...?_indexListeners![index]]);
    for (final listener in allListeners) {
      try {
        listener(index, selected);
      } catch (exception, stack) {
        FlutterError.reportError(
          FlutterErrorDetails(
            exception: exception,
            stack: stack,
            library: 'item_selector',
            context: ErrorDescription(
                'while dispatching notifications for $runtimeType'),
            informationCollector: () sync* {
              yield DiagnosticsProperty<ItemSelectionNotifier>(
                'The $runtimeType sending notification was',
                this,
                style: DiagnosticsTreeStyle.errorProperty,
              );
            },
          ),
        );
      }
    }
  }
}