once<T> method

void once<T>(
  1. String event,
  2. EventHandler<T> handler
)
inherited

This function binds the handler as a listener to the first occurrence of the event. When handler is called once, it is removed.

Implementation

void once<T>(String event, EventHandler<T> handler) {
  _eventsOnce.putIfAbsent(event, () => <Function>[]);
  _eventsOnce[event]!.add(handler);
}