AgoraRtmCallManager constructor

AgoraRtmCallManager(
  1. int _clientIndex
)

Implementation

AgoraRtmCallManager(this._clientIndex) {
  _eventSubscription =
      _addEventChannel().receiveBroadcastStream().listen((dynamic event) {
    final map = Map.from(event['data']);
    switch (event['event']) {
      case 'onLocalInvitationReceivedByPeer':
        onLocalInvitationReceivedByPeer
            ?.call(LocalInvitation.fromJson(map['localInvitation']));
        break;
      case 'onLocalInvitationAccepted':
        onLocalInvitationAccepted?.call(
            LocalInvitation.fromJson(map['localInvitation']),
            map['response']);
        break;
      case 'onLocalInvitationRefused':
        onLocalInvitationRefused?.call(
            LocalInvitation.fromJson(map['localInvitation']),
            map['response']);
        break;
      case 'onLocalInvitationCanceled':
        onLocalInvitationCanceled
            ?.call(LocalInvitation.fromJson(map['localInvitation']));
        break;
      case 'onLocalInvitationFailure':
        onLocalInvitationFailure?.call(
            LocalInvitation.fromJson(map['localInvitation']),
            map['errorCode']);
        break;
      case 'onRemoteInvitationReceived':
        onRemoteInvitationReceived
            ?.call(RemoteInvitation.fromJson(map['remoteInvitation']));
        break;
      case 'onRemoteInvitationAccepted':
        onRemoteInvitationAccepted
            ?.call(RemoteInvitation.fromJson(map['remoteInvitation']));
        break;
      case 'onRemoteInvitationRefused':
        onRemoteInvitationRefused
            ?.call(RemoteInvitation.fromJson(map['remoteInvitation']));
        break;
      case 'onRemoteInvitationCanceled':
        onRemoteInvitationCanceled
            ?.call(RemoteInvitation.fromJson(map['remoteInvitation']));
        break;
      case 'onRemoteInvitationFailure':
        onRemoteInvitationFailure?.call(
            RemoteInvitation.fromJson(map['remoteInvitation']),
            map['errorCode']);
        break;
    }
  }, onError: onError);
}