emit abstract method

Future<void> emit(
  1. String event, [
  2. dynamic payload,
  3. bool queue = false
])

Emits an event to all its registered listeners.

Listeners are executed in priority order. If any listener throws, implementations should catch and handle exceptions to prevent disrupting other listeners.

  • event: The event name to emit.
  • payload: Optional data passed to listeners.
  • queue: If true, queue the emission for async processing.

Returns a Future that completes when all listeners have finished.

Example:

await events.emit('user.updated', {'userId': 123, 'changes': {...}});

Implementation

Future<void> emit(
  String event, [
  dynamic payload,
  bool queue = false,
]);