one<T, P> method
Puts on to listen eventName
event only once.
When the event is emitted, the callback
is called
and after removes event.
Implementation
void one<T, P>(
Object? instance,
Enum eventName,
CallbackEvent<T, P> callback,
) {
final _eventOneKey = _getEventKey(instance, eventName, callback);
void _oneCallback(inst, param) {
callback(inst, param);
_oneOff<T, P>(instance, eventName, callback);
}
_oneCallbacks[_eventOneKey] ??= _oneCallback;
on<T, P>(instance, eventName, _oneCallback);
}