SubscriptionScheduleConfigurationItem.fromJson constructor

SubscriptionScheduleConfigurationItem.fromJson(
  1. Object? json
)

Implementation

factory SubscriptionScheduleConfigurationItem.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return SubscriptionScheduleConfigurationItem(
    billingThresholds: map['billing_thresholds'] == null
        ? null
        : SubscriptionItemBillingThresholds.fromJson(
            map['billing_thresholds']),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    plan: SubscriptionScheduleConfigurationItemPlanOrId.fromJson(map['plan']),
    price: SubscriptionScheduleAddInvoiceItemPriceOrId.fromJson(map['price']),
    quantity:
        map['quantity'] == null ? null : (map['quantity'] as num).toInt(),
    taxRates: map['tax_rates'] == null
        ? null
        : (map['tax_rates'] as List<Object?>)
            .map((el) => TaxRate.fromJson(el))
            .toList(),
  );
}