SubscriptionPendingUpdate.fromJson constructor
SubscriptionPendingUpdate.fromJson(
- Object? json
Implementation
factory SubscriptionPendingUpdate.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return SubscriptionPendingUpdate(
billingCycleAnchor: map['billing_cycle_anchor'] == null
? null
: DateTime.fromMillisecondsSinceEpoch(
(map['billing_cycle_anchor'] as int).toInt()),
expiresAt: DateTime.fromMillisecondsSinceEpoch(
(map['expires_at'] as int).toInt()),
subscriptionItems: map['subscription_items'] == null
? null
: (map['subscription_items'] as List<Object?>)
.map((el) => SubscriptionItem.fromJson(el))
.toList(),
trialEnd: map['trial_end'] == null
? null
: DateTime.fromMillisecondsSinceEpoch(
(map['trial_end'] as int).toInt()),
trialFromPlan: map['trial_from_plan'] == null
? null
: (map['trial_from_plan'] as bool),
);
}