PlanUpdateOptions.fromJson constructor

PlanUpdateOptions.fromJson(
  1. Object? json
)

Implementation

factory PlanUpdateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return PlanUpdateOptions(
    active: map['active'] == null ? null : (map['active'] as bool),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    nickname: map['nickname'] == null ? null : (map['nickname'] as String),
    product: map['product'] == null ? null : (map['product'] as String),
    trialPeriodDays: map['trial_period_days'] == null
        ? null
        : (map['trial_period_days'] as num).toInt(),
  );
}