once<T extends VyuhEvent> abstract method

void once<T extends VyuhEvent>(
  1. VyuhEventListener<T> listener
)

Subscribe to a single occurrence of an event of type T.

The listener will be called only once when an event of type T is emitted, then the subscription will be automatically cancelled.

Example:

vyuh.event.once<AppStartEvent>((event) {
  print('App started at ${event.timestamp}');
});

Implementation

void once<T extends VyuhEvent>(VyuhEventListener<T> listener);