on<P extends dynamic> method
Puts on to listen eventName
event.
When the event is emitted, the callback
is called.
Implementation
void on<P extends dynamic>(Enum eventName, CallbackEvent<T, P> callback) {
_events[_instanceReceived] ??= HashMap();
_events[_instanceReceived]?[eventName] ??= HashSet();
_events[_instanceReceived]?[eventName]?.add(callback);
}