CardSpendingControls.fromJson constructor

CardSpendingControls.fromJson(
  1. Object? json
)

Implementation

factory CardSpendingControls.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return CardSpendingControls(
    allowedCategories: map['allowed_categories'] == null
        ? null
        : (map['allowed_categories'] as List<Object?>)
            .map((el) =>
                IssuingCardholderSpendingControlsAllowedCategoriesItem
                    .fromJson(el))
            .toList(),
    blockedCategories: map['blocked_categories'] == null
        ? null
        : (map['blocked_categories'] as List<Object?>)
            .map((el) =>
                IssuingCardholderSpendingControlsAllowedCategoriesItem
                    .fromJson(el))
            .toList(),
    spendingLimits: map['spending_limits'] == null
        ? null
        : (map['spending_limits'] as List<Object?>)
            .map((el) => CardholderSpendingLimitsItem.fromJson(el))
            .toList(),
  );
}