OrderShippingLineItem.fromJson constructor

OrderShippingLineItem.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory OrderShippingLineItem.fromJson(Map<String, Object?> json) {
  expectExactKeys(
    json,
    const {"id", "type", "shipping"},
    "shipping refund order line item",
  );
  if (json["type"] != "shipping") {
    throw const FormatException("Invalid shipping refund order line item");
  }
  return OrderShippingLineItem(
    id: json["id"] as String,
    shipping: OrderLineItemAdjustment.fromJson(
      (json["shipping"] as Map).cast<String, Object?>(),
    ),
  );
}