process method Null safety

void process(
  1. String methodName,
  2. List data
)

Implementation

void process(String methodName, List<dynamic> data) {
  switch (methodName) {
    case 'Warning':
      warning?.call(WarningCodeConverter.fromValue(data[0]).e);
      break;
    case 'Error':
      error?.call(ErrorCodeConverter.fromValue(data[0]).e);
      break;
    case 'JoinChannelSuccess':
      joinChannelSuccess?.call(data[0], data[1], data[2]);
      break;
    case 'RejoinChannelSuccess':
      rejoinChannelSuccess?.call(data[0], data[1], data[2]);
      break;
    case 'LeaveChannel':
      leaveChannel
          ?.call(RtcStats.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'ClientRoleChanged':
      clientRoleChanged?.call(ClientRoleConverter.fromValue(data[0]).e,
          ClientRoleConverter.fromValue(data[1]).e);
      break;
    case 'UserJoined':
      userJoined?.call(data[0], data[1]);
      break;
    case 'UserOffline':
      userOffline?.call(
          data[0], UserOfflineReasonConverter.fromValue(data[1]).e);
      break;
    case 'ConnectionStateChanged':
      connectionStateChanged?.call(
          ConnectionStateTypeConverter.fromValue(data[0]).e,
          ConnectionChangedReasonConverter.fromValue(data[1]).e);
      break;
    case 'ConnectionLost':
      connectionLost?.call();
      break;
    case 'TokenPrivilegeWillExpire':
      tokenPrivilegeWillExpire?.call(data[0]);
      break;
    case 'RequestToken':
      requestToken?.call();
      break;
    case 'ActiveSpeaker':
      activeSpeaker?.call(data[0]);
      break;
    case 'VideoSizeChanged':
      videoSizeChanged?.call(data[0], data[1], data[2], data[3]);
      break;
    case 'RemoteVideoStateChanged':
      remoteVideoStateChanged?.call(
          data[0],
          VideoRemoteStateConverter.fromValue(data[1]).e,
          VideoRemoteStateReasonConverter.fromValue(data[2]).e,
          data[3]);
      break;
    case 'RemoteAudioStateChanged':
      remoteAudioStateChanged?.call(
          data[0],
          AudioRemoteStateConverter.fromValue(data[1]).e,
          AudioRemoteStateReasonConverter.fromValue(data[2]).e,
          data[3]);
      break;
    case 'LocalPublishFallbackToAudioOnly':
      localPublishFallbackToAudioOnly?.call(data[0]);
      break;
    case 'RemoteSubscribeFallbackToAudioOnly':
      remoteSubscribeFallbackToAudioOnly?.call(data[0], data[1]);
      break;
    case 'RtcStats':
      rtcStats?.call(RtcStats.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'NetworkQuality':
      networkQuality?.call(
          data[0],
          NetworkQualityConverter.fromValue(data[1]).e,
          NetworkQualityConverter.fromValue(data[2]).e);
      break;
    case 'RemoteVideoStats':
      remoteVideoStats?.call(
          RemoteVideoStats.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'RemoteAudioStats':
      remoteAudioStats?.call(
          RemoteAudioStats.fromJson(Map<String, dynamic>.from(data[0])));
      break;
    case 'RtmpStreamingStateChanged':
      rtmpStreamingStateChanged?.call(
        data[0],
        RtmpStreamingStateConverter.fromValue(data[1]).e,
        RtmpStreamingErrorCodeConverter.fromValue(data[2]).e,
      );
      break;
    case 'TranscodingUpdated':
      transcodingUpdated?.call();
      break;
    case 'StreamInjectedStatus':
      streamInjectedStatus?.call(
          data[0], data[1], InjectStreamStatusConverter.fromValue(data[2]).e);
      break;
    case 'StreamMessage':
      streamMessage?.call(data[0], data[1], data[2]);
      break;
    case 'StreamMessageError':
      streamMessageError?.call(data[0], data[1],
          ErrorCodeConverter.fromValue(data[2]).e, data[3], data[4]);
      break;
    case 'ChannelMediaRelayStateChanged':
      channelMediaRelayStateChanged?.call(
        ChannelMediaRelayStateConverter.fromValue(data[0]).e,
        ChannelMediaRelayErrorConverter.fromValue(data[1]).e,
      );
      break;
    case 'ChannelMediaRelayEvent':
      channelMediaRelayEvent
          ?.call(ChannelMediaRelayEventConverter.fromValue(data[0]).e);
      break;
    case 'MetadataReceived':
      metadataReceived?.call(data[0], data[1], data[2]);
      break;
    case 'AudioPublishStateChanged':
      audioPublishStateChanged?.call(
          data[0],
          StreamPublishStateConverter.fromValue(data[1]).e,
          StreamPublishStateConverter.fromValue(data[2]).e,
          data[3]);
      break;
    case 'VideoPublishStateChanged':
      videoPublishStateChanged?.call(
          data[0],
          StreamPublishStateConverter.fromValue(data[1]).e,
          StreamPublishStateConverter.fromValue(data[2]).e,
          data[3]);
      break;
    case 'AudioSubscribeStateChanged':
      audioSubscribeStateChanged?.call(
          data[0],
          data[1],
          StreamSubscribeStateConverter.fromValue(data[2]).e,
          StreamSubscribeStateConverter.fromValue(data[3]).e,
          data[4]);
      break;
    case 'VideoSubscribeStateChanged':
      videoSubscribeStateChanged?.call(
          data[0],
          data[1],
          StreamSubscribeStateConverter.fromValue(data[2]).e,
          StreamSubscribeStateConverter.fromValue(data[3]).e,
          data[4]);
      break;
    case 'RtmpStreamingEvent':
      rtmpStreamingEvent?.call(data[0], data[1]);
      break;
    case 'UserSuperResolutionEnabled':
      userSuperResolutionEnabled?.call(data[0], data[1],
          SuperResolutionStateReasonConverter.fromValue(data[2]).e);
      break;
  }
}