fromJson static method
Returns a new EgressResponse instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static EgressResponse? 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'broadcasting'),
'Required key "EgressResponse[broadcasting]" is missing from JSON.');
assert(json[r'broadcasting'] != null,
'Required key "EgressResponse[broadcasting]" has a null value in JSON.');
assert(json.containsKey(r'rtmps'),
'Required key "EgressResponse[rtmps]" is missing from JSON.');
assert(json[r'rtmps'] != null,
'Required key "EgressResponse[rtmps]" has a null value in JSON.');
return true;
}());
return EgressResponse(
broadcasting: mapValueOfType<bool>(json, r'broadcasting')!,
compositeRecording:
CompositeRecordingResponse.fromJson(json[r'composite_recording']),
frameRecording:
FrameRecordingResponse.fromJson(json[r'frame_recording']),
hls: EgressHLSResponse.fromJson(json[r'hls']),
individualRecording:
IndividualRecordingResponse.fromJson(json[r'individual_recording']),
rawRecording: RawRecordingResponse.fromJson(json[r'raw_recording']),
rtmps: EgressRTMPResponse.listFromJson(json[r'rtmps']),
);
}
return null;
}