once<T> static method
void
once<T>(
- void listener(
- 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));
}