PriceCurrencyOptionsValue.fromJson constructor

PriceCurrencyOptionsValue.fromJson(
  1. Object? json
)

Implementation

factory PriceCurrencyOptionsValue.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return PriceCurrencyOptionsValue(
    customUnitAmount: map['custom_unit_amount'] == null
        ? null
        : PriceCustomUnitAmount.fromJson(map['custom_unit_amount']),
    taxBehavior: map['tax_behavior'] == null
        ? null
        : ShippingRateCurrencyOptionTaxBehavior.fromJson(map['tax_behavior']),
    tiers: map['tiers'] == null
        ? null
        : (map['tiers'] as List<Object?>)
            .map((el) => PlanTiersItem.fromJson(el))
            .toList(),
    unitAmount: map['unit_amount'] == null
        ? null
        : (map['unit_amount'] as num).toInt(),
    unitAmountDecimal: map['unit_amount_decimal'] == null
        ? null
        : (map['unit_amount_decimal'] as String),
  );
}