emit<T> method

void emit<T>(
  1. String type,
  2. T data
)

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

  StreamEventEmitter events = StreamEventEmitter();
    ...
  events.emit('message', 'Hello World');

Same as emitEvent, but with a simpler syntax.

Implementation

void emit<T>(String type, T data) => emitEvent(Event<T>(type, data));