PlanTier.fromJson constructor

PlanTier.fromJson(
  1. Object? json
)

Implementation

factory PlanTier.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return PlanTier(
    flatAmount: map['flat_amount'] == null
        ? null
        : (map['flat_amount'] as num).toInt(),
    flatAmountDecimal: map['flat_amount_decimal'] == null
        ? null
        : (map['flat_amount_decimal'] as String),
    unitAmount: map['unit_amount'] == null
        ? null
        : (map['unit_amount'] as num).toInt(),
    unitAmountDecimal: map['unit_amount_decimal'] == null
        ? null
        : (map['unit_amount_decimal'] as String),
    upTo: map['up_to'] == null ? null : (map['up_to'] as num).toInt(),
  );
}