onEvent method

  1. @override
  2. @mustCallSuper
void onEvent(
  1. Bloc bloc,
  2. Object? event
)

Called whenever an event is added to any bloc with the given bloc and event.

Implementation

@override
@mustCallSuper
void onEvent(Bloc bloc, Object? event) {
  super.onEvent(bloc, event);
  if (!settings.enabled || !settings.printEvents) {
    return;
  }
  final accepted = settings.eventFilter?.call(bloc, event) ?? true;
  if (!accepted) {
    return;
  }
  _talker.logTyped(
    BlocEventLog(
      bloc: bloc,
      event: event,
      settings: settings,
    ),
  );
}