on method

void on(
  1. Events event,
  2. Function handler
)

Registers an event listener for participant-related events.

  • This method allows you to listen to events associated with a Participant, such as stream updates or state changes. When the specified event occurs, the provided handler will be invoked.

Parameters

  • event: The Events type to listen for.

  • handler: A callback function that is executed whenever the specified event is emitted. The callback may receive event-specific data as arguments.

Returns

  • void

Example

participant.on(Events.streamEnabled, (RTCStream stream) {
  // Handle enabled stream
});

Implementation

void on(Events event, Function handler) => _on(event, handler);