onEvent method

  1. @override
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
void onEvent(Bloc<dynamic, dynamic> bloc, Object? event) {
  super.onEvent(bloc, event);
  assert(() {
    final context = CausalityZone.currentContext();
    TrinityEventBus.instance.emit(CausalEvent(
      parentId: context?.eventId,
      type: CausalEventType.userAction,
      description: '${bloc.runtimeType}: event ${event.runtimeType}',
      metadata: {
        'bloc_type': bloc.runtimeType.toString(),
        'event_type': event.runtimeType.toString(),
      },
    ));
    return true;
  }());
}