fromJson static method

TelegramPaymentPurposePremiumGiftCodes? fromJson(
  1. Map<String, dynamic>? json
)
override

Implementation

static TelegramPaymentPurposePremiumGiftCodes? fromJson(
  Map<String, dynamic>? json,
) {
  if (json == null) {
    return null;
  }

  return TelegramPaymentPurposePremiumGiftCodes(
    boostedChatId: (json['boosted_chat_id'] as int?) ?? 0,
    currency: (json['currency'] as String?) ?? '',
    amount: (json['amount'] as int?) ?? 0,
    userIds: List<int>.from(
      tdListFromJson(
        json['user_ids'],
      ).map((item) => int.tryParse((item as dynamic)?.toString() ?? '') ?? 0),
    ),
    monthCount: (json['month_count'] as int?) ?? 0,
    text: FormattedText.fromJson(tdMapFromJson(json['text'])),
  );
}