emit method
emit will always emit twice... first, by the name of the event submitted, and secondly, by the name of the special event 'all'
Implementation
void emit(String event, [T? data]) {
for (var name in [event, 'all']) {
var e = Event(name, data);
eventStream.add(e);
if (callbacks.containsKey(name)) {
for (var callback in callbacks[name]!) {
callback(e);
}
}
}
}