fromJson static method
Returns a new PublishedTrackFlags instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static PublishedTrackFlags? 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'audio'),
'Required key "PublishedTrackFlags[audio]" is missing from JSON.');
assert(json[r'audio'] != null,
'Required key "PublishedTrackFlags[audio]" has a null value in JSON.');
assert(json.containsKey(r'screenshare'),
'Required key "PublishedTrackFlags[screenshare]" is missing from JSON.');
assert(json[r'screenshare'] != null,
'Required key "PublishedTrackFlags[screenshare]" has a null value in JSON.');
assert(json.containsKey(r'screenshare_audio'),
'Required key "PublishedTrackFlags[screenshare_audio]" is missing from JSON.');
assert(json[r'screenshare_audio'] != null,
'Required key "PublishedTrackFlags[screenshare_audio]" has a null value in JSON.');
assert(json.containsKey(r'video'),
'Required key "PublishedTrackFlags[video]" is missing from JSON.');
assert(json[r'video'] != null,
'Required key "PublishedTrackFlags[video]" has a null value in JSON.');
return true;
}());
return PublishedTrackFlags(
audio: mapValueOfType<bool>(json, r'audio')!,
screenshare: mapValueOfType<bool>(json, r'screenshare')!,
screenshareAudio: mapValueOfType<bool>(json, r'screenshare_audio')!,
video: mapValueOfType<bool>(json, r'video')!,
);
}
return null;
}