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