Invoices.fromJson constructor

Invoices.fromJson(
  1. Map<String, dynamic> json
)

Implementation

Invoices.fromJson(Map<String, dynamic> json) {
  id = json['id'];
  createdAt = json['createdAt'];
  no = json['no'];
  price = json['price'] != null
      ? double.tryParse(json['price'].toString())
      : null;
  currency = json['currency'];
  tax = json['tax'] != null ? double.tryParse(json['tax'].toString()) : null;
  productDiscount = json['productDiscount'] != null
      ? double.tryParse(json['productDiscount'].toString())
      : null;
  cartDiscount = json['cartDiscount'] != null
      ? double.tryParse(json['cartDiscount'].toString())
      : null;
  shippingPrice = json['shippingPrice'] != null
      ? double.tryParse(json['shippingPrice'].toString())
      : null;
  cashOnDeliveryPrice = json['cashOnDeliveryPrice'] != null
      ? double.tryParse(json['cashOnDeliveryPrice'].toString())
      : null;
  store = json['store'] != null ? StoreDTO.fromJson(json['store']) : null;
  if (json['taxDetails'] != null) {
    taxDetails = <TaxDTO>[];
    json['taxDetails'].forEach((v) {
      taxDetails!.add(TaxDTO.fromJson(v));
    });
  }
  refund = json['refund'];
  symbol = json['symbol'];
  discount = json['discount'] != null
      ? double.tryParse(json['discount'].toString())
      : null;
  promoCodeDiscount = json['promoCodeDiscount'] != null
      ? double.tryParse(json['promoCodeDiscount'].toString())
      : null;
  shippingURL = json['shippingURL'];
}