PortalSubscriptionUpdate.fromJson constructor

PortalSubscriptionUpdate.fromJson(
  1. Object? json
)

Implementation

factory PortalSubscriptionUpdate.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return PortalSubscriptionUpdate(
    defaultAllowedUpdates: (map['default_allowed_updates'] as List<Object?>)
        .map((el) =>
            PortalSubscriptionUpdateDefaultAllowedUpdatesItem.fromJson(el))
        .toList(),
    enabled: (map['enabled'] as bool),
    products: map['products'] == null
        ? null
        : (map['products'] as List<Object?>)
            .map((el) => PortalSubscriptionUpdateProduct.fromJson(el))
            .toList(),
    prorationBehavior: PortalSubscriptionCancelProrationBehavior.fromJson(
        map['proration_behavior']),
  );
}