SubscriptionItem.fromJson constructor
SubscriptionItem.fromJson(
- Object? json
Implementation
factory SubscriptionItem.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return SubscriptionItem(
billingThresholds: map['billing_thresholds'] == null
? null
: SubscriptionItemBillingThresholds.fromJson(
map['billing_thresholds']),
created: (map['created'] as num).toInt(),
id: (map['id'] as String),
metadata: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
plan: Plan.fromJson(map['plan']),
price: Price.fromJson(map['price']),
quantity:
map['quantity'] == null ? null : (map['quantity'] as num).toInt(),
subscription: (map['subscription'] as String),
taxRates: map['tax_rates'] == null
? null
: (map['tax_rates'] as List<Object?>)
.map((el) => TaxRate.fromJson(el))
.toList(),
);
}