SessionShippingRateData.fromJson constructor

SessionShippingRateData.fromJson(
  1. Object? json
)

Implementation

factory SessionShippingRateData.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return SessionShippingRateData(
    deliveryEstimate: map['delivery_estimate'] == null
        ? null
        : SessionDeliveryEstimate.fromJson(map['delivery_estimate']),
    displayName: (map['display_name'] as String),
    fixedAmount: map['fixed_amount'] == null
        ? null
        : SessionFixedAmount.fromJson(map['fixed_amount']),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    taxBehavior: map['tax_behavior'] == null
        ? null
        : ShippingRateCurrencyOptionTaxBehavior.fromJson(map['tax_behavior']),
    taxCode: map['tax_code'] == null ? null : (map['tax_code'] as String),
  );
}