fromJson static method
Returns a new CallStatsMapPublisher instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static CallStatsMapPublisher? 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'is_live'),
'Required key "CallStatsMapPublisher[is_live]" is missing from JSON.');
assert(json[r'is_live'] != null,
'Required key "CallStatsMapPublisher[is_live]" has a null value in JSON.');
assert(json.containsKey(r'published_tracks'),
'Required key "CallStatsMapPublisher[published_tracks]" is missing from JSON.');
assert(json[r'published_tracks'] != null,
'Required key "CallStatsMapPublisher[published_tracks]" has a null value in JSON.');
assert(json.containsKey(r'user_id'),
'Required key "CallStatsMapPublisher[user_id]" is missing from JSON.');
assert(json[r'user_id'] != null,
'Required key "CallStatsMapPublisher[user_id]" has a null value in JSON.');
assert(json.containsKey(r'user_session_id'),
'Required key "CallStatsMapPublisher[user_session_id]" is missing from JSON.');
assert(json[r'user_session_id'] != null,
'Required key "CallStatsMapPublisher[user_session_id]" has a null value in JSON.');
return true;
}());
return CallStatsMapPublisher(
isLive: mapValueOfType<bool>(json, r'is_live')!,
location: CallStatsLocation.fromJson(json[r'location']),
name: mapValueOfType<String>(json, r'name'),
publishedTracks:
PublishedTrackFlags.fromJson(json[r'published_tracks'])!,
publisherType: mapValueOfType<String>(json, r'publisher_type'),
userId: mapValueOfType<String>(json, r'user_id')!,
userSessionId: mapValueOfType<String>(json, r'user_session_id')!,
);
}
return null;
}