fromJson static method
Returns a new CallStatsReportSummaryResponse instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static CallStatsReportSummaryResponse? 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'call_cid'),
'Required key "CallStatsReportSummaryResponse[call_cid]" is missing from JSON.');
assert(json[r'call_cid'] != null,
'Required key "CallStatsReportSummaryResponse[call_cid]" has a null value in JSON.');
assert(json.containsKey(r'call_duration_seconds'),
'Required key "CallStatsReportSummaryResponse[call_duration_seconds]" is missing from JSON.');
assert(json[r'call_duration_seconds'] != null,
'Required key "CallStatsReportSummaryResponse[call_duration_seconds]" has a null value in JSON.');
assert(json.containsKey(r'call_session_id'),
'Required key "CallStatsReportSummaryResponse[call_session_id]" is missing from JSON.');
assert(json[r'call_session_id'] != null,
'Required key "CallStatsReportSummaryResponse[call_session_id]" has a null value in JSON.');
assert(json.containsKey(r'call_status'),
'Required key "CallStatsReportSummaryResponse[call_status]" is missing from JSON.');
assert(json[r'call_status'] != null,
'Required key "CallStatsReportSummaryResponse[call_status]" has a null value in JSON.');
assert(json.containsKey(r'first_stats_time'),
'Required key "CallStatsReportSummaryResponse[first_stats_time]" is missing from JSON.');
assert(json[r'first_stats_time'] != null,
'Required key "CallStatsReportSummaryResponse[first_stats_time]" has a null value in JSON.');
return true;
}());
return CallStatsReportSummaryResponse(
callCid: mapValueOfType<String>(json, r'call_cid')!,
callDurationSeconds:
mapValueOfType<int>(json, r'call_duration_seconds')!,
callSessionId: mapValueOfType<String>(json, r'call_session_id')!,
callStatus: mapValueOfType<String>(json, r'call_status')!,
createdAt: mapDateTime(json, r'created_at', r''),
firstStatsTime: mapDateTime(json, r'first_stats_time', r'')!,
minUserRating: mapValueOfType<int>(json, r'min_user_rating'),
qualityScore: mapValueOfType<int>(json, r'quality_score'),
);
}
return null;
}