fromJson static method

CallIngressResponse? fromJson(
  1. dynamic value
)

Returns a new CallIngressResponse instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static CallIngressResponse? fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();

    // Ensure that the map contains the required keys.
    // Note 1: the values aren't checked for validity beyond being non-null.
    // Note 2: this code is stripped in release mode!
    assert(() {
      assert(json.containsKey(r'rtmp'),
          'Required key "CallIngressResponse[rtmp]" is missing from JSON.');
      assert(json[r'rtmp'] != null,
          'Required key "CallIngressResponse[rtmp]" has a null value in JSON.');
      assert(json.containsKey(r'srt'),
          'Required key "CallIngressResponse[srt]" is missing from JSON.');
      assert(json[r'srt'] != null,
          'Required key "CallIngressResponse[srt]" has a null value in JSON.');
      assert(json.containsKey(r'whip'),
          'Required key "CallIngressResponse[whip]" is missing from JSON.');
      assert(json[r'whip'] != null,
          'Required key "CallIngressResponse[whip]" has a null value in JSON.');
      return true;
    }());

    return CallIngressResponse(
      rtmp: RTMPIngress.fromJson(json[r'rtmp'])!,
      srt: SRTIngress.fromJson(json[r'srt'])!,
      whip: WHIPIngress.fromJson(json[r'whip'])!,
    );
  }
  return null;
}