emitEvent<T> method

void emitEvent<T>(
  1. Event<T> event
)

Emit a message on a specific event type and data type. This will broadcast the event to all listeners that match the same event type and data type.

  final emitter = EventEmitter();
    ...
  events.emitEvent(Event('message', 'Hello World'));

A custom event can be emitted by extending the Event class. This allows for custom data to be passed to the listeners, it's expected to have the same effect as a normal event.

Implementation

void emitEvent<T>(Event<T> event) => controller.add(event);