fromJson static method
Returns a new ParagraphAgreementDto instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static ParagraphAgreementDto? fromJson(dynamic value) {
if (value is ParagraphAgreementDto) {
return 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(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "ParagraphAgreementDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "ParagraphAgreementDto[$key]" has a null value in JSON.');
});
return true;
}());
return ParagraphAgreementDto(
timestamp: mapValueOfType<int>(json, r'timestamp'),
paragraph: mapValueOfType<String>(json, r'paragraph'),
accepted: mapValueOfType<bool>(json, r'accepted'),
inTreatment: mapValueOfType<bool>(json, r'inTreatment'),
canceled: mapValueOfType<bool>(json, r'canceled'),
careProviderReference: mapValueOfType<String>(json, r'careProviderReference'),
decisionReference: mapValueOfType<String>(json, r'decisionReference'),
start: mapValueOfType<int>(json, r'start'),
end: mapValueOfType<int>(json, r'end'),
cancelationDate: mapValueOfType<int>(json, r'cancelationDate'),
quantityValue: mapValueOfType<double>(json, r'quantityValue'),
quantityUnit: mapValueOfType<String>(json, r'quantityUnit'),
ioRequestReference: mapValueOfType<String>(json, r'ioRequestReference'),
responseType: mapValueOfType<String>(json, r'responseType'),
refusalJustification: mapCastOfType<String, String>(json, r'refusalJustification') ?? const {},
verses: json[r'verses'] is Set ? (json[r'verses'] as Set).cast<int>() : const {},
coverageType: mapValueOfType<String>(json, r'coverageType'),
unitNumber: mapValueOfType<double>(json, r'unitNumber'),
strength: mapValueOfType<double>(json, r'strength'),
strengthUnit: mapValueOfType<String>(json, r'strengthUnit'),
agreementAppendices: AgreementAppendixDto.listFromJson(json[r'agreementAppendices']) ?? const [],
documentId: mapValueOfType<String>(json, r'documentId'),
);
}
return null;
}