setEventHandler method Null safety

void setEventHandler(
  1. RtcEngineEventHandler handler

Sets the engine event handler.

After setting the engine event handler, you can listen for engine events and receive the statistics of the corresponding RtcEngine instance.

Parameter handler The event handler.


void setEventHandler(RtcEngineEventHandler handler) {
  _handler = handler;
  _subscription ??= _stream.listen((event) {
    final eventMap = Map<dynamic, dynamic>.from(event);
    final methodName = eventMap['methodName'] as String;
    final data = eventMap['data'];
    _instance?._handler?.process(methodName, data);