fromJson static method
Returns a new LoanReportCreateData instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static LoanReportCreateData? 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'annualIncome'),
'Required key "LoanReportCreateData[annualIncome]" is missing from JSON.');
assert(json[r'annualIncome'] != null,
'Required key "LoanReportCreateData[annualIncome]" has a null value in JSON.');
assert(json.containsKey(r'creditRating'),
'Required key "LoanReportCreateData[creditRating]" is missing from JSON.');
assert(json[r'creditRating'] != null,
'Required key "LoanReportCreateData[creditRating]" has a null value in JSON.');
return true;
}());
return LoanReportCreateData(
annualIncome: mapValueOfType<int>(json, r'annualIncome')!,
creditRating: ProvidedCreditRating.fromJson(json[r'creditRating'])!,
totalDebt: mapValueOfType<int>(json, r'totalDebt'),
countOfDerogatories: mapValueOfType<int>(json, r'countOfDerogatories'),
state: State.fromJson(json[r'state']),
loanPurpose: LoanPurpose.fromJson(json[r'loanPurpose']),
loanAmount: mapValueOfType<int>(json, r'loanAmount'),
);
}
return null;
}