CheckoutSessionShippingCost.fromJson constructor

CheckoutSessionShippingCost.fromJson(
  1. Object? json
)

Implementation

factory CheckoutSessionShippingCost.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return CheckoutSessionShippingCost(
    amountSubtotal: (map['amount_subtotal'] as num).toInt(),
    amountTax: (map['amount_tax'] as num).toInt(),
    amountTotal: (map['amount_total'] as num).toInt(),
    shippingRate: map['shipping_rate'] == null
        ? null
        : ShippingRateOrId.fromJson(map['shipping_rate']),
    taxes: map['taxes'] == null
        ? null
        : (map['taxes'] as List<Object?>)
            .map((el) => LineItemsTaxAmount.fromJson(el))
            .toList(),
  );
}