once<T> static method

void once<T>(
  1. void listener(
    1. T event
    )
)

Implementation

static void once<T>(void Function(T event) listener) {
  Function? wrapper;
  wrapper = (event) {
    listener(event as T);
    off<T>(wrapper as void Function(T));
  };
  on<T>(wrapper as void Function(T));
}