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(
        ((json['user_ids'] as List<dynamic>?) ?? <dynamic>[])
            .map((item) =>
                (item is int ? item : int.tryParse(item.toString()) ?? 0))
            .toList()),
    monthCount: (json['month_count'] as int?) ?? 0,
    text: FormattedText.fromJson(json['text'] as Map<String, dynamic>?)!,
  );
}