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