fromJson static method
Returns a new InvoiceSender instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static InvoiceSender? fromJson(dynamic value) {
if (value is InvoiceSender) {
return 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 "InvoiceSender[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "InvoiceSender[$key]" has a null value in JSON.');
});
return true;
}());
return InvoiceSender(
nihii: mapValueOfType<int>(json, r'nihii'),
bic: mapValueOfType<String>(json, r'bic'),
iban: mapValueOfType<String>(json, r'iban'),
bce: mapValueOfType<int>(json, r'bce'),
ssin: mapValueOfType<String>(json, r'ssin'),
lastName: mapValueOfType<String>(json, r'lastName'),
firstName: mapValueOfType<String>(json, r'firstName'),
phoneNumber: mapValueOfType<int>(json, r'phoneNumber'),
conventionCode: mapValueOfType<int>(json, r'conventionCode'),
isSpecialist: mapValueOfType<bool>(json, r'isSpecialist')!,
);
}
return null;
}