fromJson static method
Returns a new EsimLocationEvent instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static EsimLocationEvent? 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'iccid'), 'Required key "EsimLocationEvent[iccid]" is missing from JSON.');
assert(json[r'iccid'] != null, 'Required key "EsimLocationEvent[iccid]" has a null value in JSON.');
assert(json.containsKey(r'mcc'), 'Required key "EsimLocationEvent[mcc]" is missing from JSON.');
assert(json[r'mcc'] != null, 'Required key "EsimLocationEvent[mcc]" has a null value in JSON.');
assert(json.containsKey(r'location'), 'Required key "EsimLocationEvent[location]" is missing from JSON.');
assert(json[r'location'] != null, 'Required key "EsimLocationEvent[location]" has a null value in JSON.');
assert(json.containsKey(r'network'), 'Required key "EsimLocationEvent[network]" is missing from JSON.');
assert(json[r'network'] != null, 'Required key "EsimLocationEvent[network]" has a null value in JSON.');
assert(json.containsKey(r'occurredAt'), 'Required key "EsimLocationEvent[occurredAt]" is missing from JSON.');
assert(json[r'occurredAt'] != null, 'Required key "EsimLocationEvent[occurredAt]" has a null value in JSON.');
return true;
}());
return EsimLocationEvent(
iccid: mapValueOfType<String>(json, r'iccid')!,
mcc: mapValueOfType<int>(json, r'mcc')!,
mnc: mapValueOfType<int>(json, r'mnc'),
location: mapValueOfType<String>(json, r'location')!,
network: mapValueOfType<String>(json, r'network')!,
occurredAt: mapDateTime(json, r'occurredAt', r'')!,
);
}
return null;
}