OrderProductLineItem.fromJson constructor

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

Implementation

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