once method

void once(
  1. String event,
  2. Function 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.

@param String event - The event to add the handler to @param Function handler - The handler to bind to the event @return void

Implementation

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