handleAllPlayerEvents method

void handleAllPlayerEvents(
  1. dynamic onEvent(
    1. dynamic event
    )
)

Listens to all player events and triggers the provided onEvent callback Returns dictionary with 'playerReference', 'type' and 'event' or 'ad' keys.

  • onEvent: A callback function that handles the event.

Implementation

void handleAllPlayerEvents(Function(dynamic event) onEvent) {
  _playerEvents.listen((event) {
    if (event['playerReference'] == playerReference) {
      onEvent(event);
    }
  });
}