fromJson static method
Returns a new CallSessionResponse instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static CallSessionResponse? 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(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "CallSessionResponse[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "CallSessionResponse[$key]" has a null value in JSON.');
});
return true;
}());
return CallSessionResponse(
acceptedBy: mapCastOfType<String, String>(json, r'accepted_by')!
.convertValueToDateTime(),
endedAt: mapDateTime(json, r'ended_at', r''),
id: mapValueOfType<String>(json, r'id')!,
liveEndedAt: mapDateTime(json, r'live_ended_at', r''),
liveStartedAt: mapDateTime(json, r'live_started_at', r''),
missedBy: mapCastOfType<String, String>(json, r'missed_by')!
.convertValueToDateTime(),
participants: CallParticipantResponse.listFromJson(json[r'participants']),
participantsCountByRole: mapCastOfType<String, int>(json, r'participants_count_by_role')!,
rejectedBy: mapCastOfType<String, String>(json, r'rejected_by')!
.convertValueToDateTime(),
startedAt: mapDateTime(json, r'started_at', r''),
timerEndsAt: mapDateTime(json, r'timer_ends_at', r''),
);
}
return null;
}