Cart.fromJson constructor

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

Implementation

Cart.fromJson(Map<String, dynamic> json) {
  cartId = json['cartId'];
  intent = json['intent'];
  if (json['items'] != null) {
    items = <Items>[];
    json['items'].forEach((v) {
      items!.add(Items.fromJson(v));
    });
  }
  total = json['total'] != null ? UnitPrice.fromJson(json['total']) : null;
  if (json['shippingMethods'] != null) {
    shippingMethods = <ShippingMethod>[];
    json['shippingMethods'].forEach((v) {
      shippingMethods!.add(ShippingMethod.fromJson(v));
    });
  }
  shippingAddress = json['shippingAddress'] != null
      ? ShippingAddress.fromJson(json['shippingAddress'])
      : null;
  billingAddress = json['billingAddress'] != null
      ? ShippingAddress.fromJson(json['billingAddress'])
      : null;
  totalAllowedOverCaptureAmount =
      json['totalAllowedOverCaptureAmount'] != null
          ? UnitPrice.fromJson(json['totalAllowedOverCaptureAmount'])
          : null;
}