notify method

  1. @override
void notify(
  1. IContext? context,
  2. Parameters args
)
override

Fires this event and notifies all registred listeners.

  • context (optional) a context to trace execution through call chain.
  • args the parameters to raise this event with. throws an InvocationException if the event fails to be raised.

Implementation

@override
void notify(IContext? context, Parameters args) {
  for (var i = 0; i < _listeners.length; i++) {
    try {
      var listener = _listeners[i];
      listener.onEvent(context, this, args);
    } catch (ex) {
      throw InvocationException(
              context != null ? ContextResolver.getTraceId(context) : null,
              'EXEC_FAILED',
              'Raising event ${getName()} failed: $ex')
          .withDetails('event', getName())
          .wrap(ex);
    }
  }
}