once method Null safety
This function binds the handler
as listener to the first
occurrence of the event
. When handler
is called once,
it is removed.
Implementation
void once(String event, Function handler) {
if (singleEvents.containsKey(event)) {
singleEvents[event]!.add(handler);
} else {
singleEvents[event] = [handler];
}
}