Order.fromJson constructor
Implementation
factory Order.fromJson(Map<String, dynamic> json) => Order(
number: json['number'],
date: DateTime.parse(json['date']),
dateShipped: json['date_shipped'] == ''
? null
: DateTime.parse(json['date_shipped']),
discountCode:
json['discount_code'] == '' ? null : json['discount_code'],
message: json['message'],
email: json['email'],
phone: json['phone'],
companyTitle:
json['company_title'] == '' ? null : json['company_title'],
shippingCity: json['shipping_city'],
shippingCountry: json['shipping_country'],
shippingCountryCode: json['shipping_country_code'],
shippingInstructions: json['shipping_instructions'],
shippingName: json['shipping_name'],
shippingPostcode: json['shipping_postcode'],
shippingService: json['shipping_service'],
shippingState: json['shipping_state'],
shippingStreet: json['shipping_street'],
total: json['total'],
totalCCFee: json['total_ccfee'],
totalDiscount: double.parse(json['total_discount']),
totalKickback: json['total_kickback'],
totalSeller: json['total_seller'],
totalShipping: json['total_shipping'],
totalSubtotal: json['total_subtotal'],
totalTindieFee: json['total_tindiefee'],
trackingCode:
json['tracking_code'] == '' ? null : json['tracking_code'],
trackingUrl: json['tracking_url'] == '' ? null : json['tracking_url'],
payment: json['payment'],
refunded: json['refunded'],
shipped: json['shipped'],
items:
List<Item>.from(json['items'].map((model) => Item.fromJson(model))),
);