fromMap static method

RtcStatsType? fromMap(
  1. dynamic stats
)

Creates an RtcStatsType basing on the Map received from the native side.

Implementation

static RtcStatsType? fromMap(dynamic stats) {
  switch (stats['type']) {
    case 'media-source':
      {
        if (stats['kind'] == 'audio') {
          return RtcAudioSourceStats.fromMap(stats);
        } else {
          return RtcVideoSourceStats.fromMap(stats);
        }
      }

    case 'remote-candidate':
      {
        return RtcIceCandidateStats.fromMap(stats);
      }
    case 'local-candidate':
      {
        return RtcIceCandidateStats.fromMap(stats);
      }

    case 'outbound-rtp':
      {
        return RtcOutboundRtpStreamStats.fromMap(stats);
      }
    case 'inbound-rtp':
      {
        return RtcInboundRtpStreamStats.fromMap(stats);
      }
    case 'transport':
      {
        return RtcTransportStats.fromMap(stats);
      }
    case 'remote-inbound-rtp':
      {
        return RtcRemoteInboundRtpStreamStats.fromMap(stats);
      }
    case 'remote-outbound-rtp':
      {
        return RtcRemoteOutboundRtpStreamStats.fromMap(stats);
      }
    case 'candidate-pair':
      {
        return RtcIceCandidatePairStats.fromMap(stats);
      }
    default:
      {
        return null;
      }
  }
}