fromJson static method
Returns a new SimCard instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static SimCard? 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 "SimCard[iccid]" is missing from JSON.');
assert(json[r'iccid'] != null, 'Required key "SimCard[iccid]" has a null value in JSON.');
assert(json.containsKey(r'status'), 'Required key "SimCard[status]" is missing from JSON.');
assert(json[r'status'] != null, 'Required key "SimCard[status]" has a null value in JSON.');
return true;
}());
return SimCard(
iccid: mapValueOfType<String>(json, r'iccid')!,
status: SimCardStatusEnum.fromJson(json[r'status'])!,
lpaCode: mapValueOfType<String>(json, r'lpaCode'),
smdpAddress: mapValueOfType<String>(json, r'smdpAddress'),
activationCode: mapValueOfType<String>(json, r'activationCode'),
qrCodeUrl: mapValueOfType<String>(json, r'qrCodeUrl'),
pin: mapValueOfType<String>(json, r'pin'),
puk: mapValueOfType<String>(json, r'puk'),
number: mapValueOfType<String>(json, r'number'),
iosQuickInstall: mapValueOfType<String>(json, r'iosQuickInstall'),
androidQuickInstall: mapValueOfType<String>(json, r'androidQuickInstall'),
usage: EsimUsage.fromJson(json[r'usage']),
);
}
return null;
}