CallBackend.fromJson constructor

CallBackend.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory CallBackend.fromJson(Map<String, Object?> json) {
  final String type = json['type'] as String;
  if (type == 'mesh') {
    return MeshBackend(
      type: type,
    );
  } else if (type == 'livekit') {
    return LiveKitBackend(
      livekitAlias: json['livekit_alias'] as String,
      livekitServiceUrl: json['livekit_service_url'] as String,
      type: type,
    );
  } else {
    throw MatrixSDKVoipException(
        'Invalid type: $type in CallBackend.fromJson');
  }
}