WooOrderPayload.fromJson constructor

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

Implementation

WooOrderPayload.fromJson(Map<String, dynamic> json) {
  paymentMethod = json['payment_method'];
  paymentMethodTitle = json['payment_method_title'];
  setPaid = json['set_paid'];
  status = json['status'];
  currency = json['currency'];
  customerId = json['customer_id'];
  customerNote = json['customer_note'];
  parentId = json['parent_id'];
  if (json['meta_data'] != null) {
    metaData = <WooOrderPayloadMetaData>[];
    json['meta_data'].forEach((v) {
      metaData!.add(new WooOrderPayloadMetaData.fromJson(v));
    });
  }
  if (json['fee_lines'] != null) {
    feeLines = <WooOrderPayloadFeeLines>[];
    json['fee_lines'].forEach((v) {
      feeLines!.add(new WooOrderPayloadFeeLines.fromJson(v));
    });
  }
  if (json['coupon_lines'] != null) {
    couponLines = <WooOrderPayloadCouponLines>[];
    json['coupon_lines'].forEach((v) {
      couponLines!.add(new WooOrderPayloadCouponLines.fromJson(v));
    });
  }
  billing = json['billing'] != null
      ? new WooOrderPayloadBilling.fromJson(json['billing'])
      : null;
  shipping = json['shipping'] != null
      ? new WooOrderPayloadShipping.fromJson(json['shipping'])
      : null;
  if (json['line_items'] != null) {
    lineItems = <LineItems>[];
    json['line_items'].forEach((v) {
      lineItems!.add(new LineItems.fromJson(v));
    });
  }
  if (json['shipping_lines'] != null) {
    shippingLines = <ShippingLines>[];
    json['shipping_lines'].forEach((v) {
      shippingLines!.add(new ShippingLines.fromJson(v));
    });
  }
}