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