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