fromJson static method

ReturnIssuedVoucher? fromJson(
  1. Object? json
)

Implementation

static ReturnIssuedVoucher? fromJson(Object? json) {
  if (json is! Map || json['id'] is! String) return null;
  String? text(Object? w) => w is String && w.isNotEmpty ? w : null;
  VoucherValidity? gueltigkeit;
  try {
    gueltigkeit = json['validity'] == null ? null : _gueltigkeit('cancelReceipt', json['validity']);
  } on KasseneckValidationError {
    gueltigkeit = null;
  }
  return ReturnIssuedVoucher(
    id: json['id'] as String,
    code: text(json['code']),
    codeSuffix: text(json['codeSuffix']),
    faceValueCents: json['faceValueCents'] is int ? json['faceValueCents'] as int : null,
    typeId: text(json['typeId']),
    typeName: text(json['typeName']),
    validity: gueltigkeit,
    fromReturn: json['fromReturn'] == true,
    reprintRequired: json['reprintRequired'] == true,
  );
}