emit<T> method
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.
EventEmitter events = EventEmitter();
...
events.emit('message', 'Hello World');
Same as emitEvent
, but with a simpler syntax.
Implementation
bool emit<T>(String type, [T? data]) {
if (data == null) return emitEvent(Event(type, null));
return emitEvent(Event<T>(type, data));
}