fromJson static method
Returns a new SipInboundCredentials instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static SipInboundCredentials? 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'api_key'),
'Required key "SipInboundCredentials[api_key]" is missing from JSON.');
assert(json[r'api_key'] != null,
'Required key "SipInboundCredentials[api_key]" has a null value in JSON.');
assert(json.containsKey(r'call_custom_data'),
'Required key "SipInboundCredentials[call_custom_data]" is missing from JSON.');
assert(json[r'call_custom_data'] != null,
'Required key "SipInboundCredentials[call_custom_data]" has a null value in JSON.');
assert(json.containsKey(r'call_id'),
'Required key "SipInboundCredentials[call_id]" is missing from JSON.');
assert(json[r'call_id'] != null,
'Required key "SipInboundCredentials[call_id]" has a null value in JSON.');
assert(json.containsKey(r'call_type'),
'Required key "SipInboundCredentials[call_type]" is missing from JSON.');
assert(json[r'call_type'] != null,
'Required key "SipInboundCredentials[call_type]" has a null value in JSON.');
assert(json.containsKey(r'token'),
'Required key "SipInboundCredentials[token]" is missing from JSON.');
assert(json[r'token'] != null,
'Required key "SipInboundCredentials[token]" has a null value in JSON.');
assert(json.containsKey(r'user_custom_data'),
'Required key "SipInboundCredentials[user_custom_data]" is missing from JSON.');
assert(json[r'user_custom_data'] != null,
'Required key "SipInboundCredentials[user_custom_data]" has a null value in JSON.');
assert(json.containsKey(r'user_id'),
'Required key "SipInboundCredentials[user_id]" is missing from JSON.');
assert(json[r'user_id'] != null,
'Required key "SipInboundCredentials[user_id]" has a null value in JSON.');
return true;
}());
return SipInboundCredentials(
apiKey: mapValueOfType<String>(json, r'api_key')!,
callCustomData:
mapCastOfType<String, Object>(json, r'call_custom_data')!,
callId: mapValueOfType<String>(json, r'call_id')!,
callType: mapValueOfType<String>(json, r'call_type')!,
token: mapValueOfType<String>(json, r'token')!,
userCustomData:
mapCastOfType<String, Object>(json, r'user_custom_data')!,
userId: mapValueOfType<String>(json, r'user_id')!,
);
}
return null;
}