on<T, P> method
Puts on to listen eventName
event.
When the event is emitted, the callback
is called.
Implementation
void on<T, P>(
Object? instance,
Enum eventName,
CallbackEvent<T, P> callback,
) {
if (instance is ReactterNotifyManager) {
instance._addListener();
}
final _eventKey = _getEventKey(instance, eventName);
_events[_eventKey] ??= HashSet();
_events[_eventKey]?.add(callback);
}