fromJson static method
Returns a new ReimbursementDto instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static ReimbursementDto? fromJson(dynamic value) {
if (value is ReimbursementDto) {
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 "ReimbursementDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "ReimbursementDto[$key]" has a null value in JSON.');
});
return true;
}());
return ReimbursementDto(
from: mapValueOfType<int>(json, r'from'),
to: mapValueOfType<int>(json, r'to'),
deliveryEnvironment: ReimbursementDtoDeliveryEnvironmentEnum.fromJson(json[r'deliveryEnvironment']),
code: mapValueOfType<String>(json, r'code'),
codeType: ReimbursementDtoCodeTypeEnum.fromJson(json[r'codeType']),
multiple: ReimbursementDtoMultipleEnum.fromJson(json[r'multiple']),
temporary: mapValueOfType<bool>(json, r'temporary'),
reference: mapValueOfType<bool>(json, r'reference'),
legalReferencePath: mapValueOfType<String>(json, r'legalReferencePath'),
flatRateSystem: mapValueOfType<bool>(json, r'flatRateSystem'),
reimbursementBasePrice: json[r'reimbursementBasePrice'] == null ? null : num.parse(json[r'reimbursementBasePrice'].toString()),
referenceBasePrice: json[r'referenceBasePrice'] == null ? null : num.parse(json[r'referenceBasePrice'].toString()),
copaymentSupplement: json[r'copaymentSupplement'] == null ? null : num.parse(json[r'copaymentSupplement'].toString()),
pricingUnit: PricingDto.fromJson(json[r'pricingUnit']),
pricingSlice: PricingDto.fromJson(json[r'pricingSlice']),
reimbursementCriterion: ReimbursementCriterionDto.fromJson(json[r'reimbursementCriterion']),
copayments: CopaymentDto.listFromJson(json[r'copayments']) ?? const [],
);
}
return null;
}