fromJson static method

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

Implementation

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

  return GiveawayParameters(
    boostedChatId: (json['boosted_chat_id'] as int?) ?? 0,
    additionalChatIds: List<int>.from(
      tdListFromJson(
        json['additional_chat_ids'],
      ).map((item) => int.tryParse((item as dynamic)?.toString() ?? '') ?? 0),
    ),
    winnersSelectionDate: (json['winners_selection_date'] as int?) ?? 0,
    onlyNewMembers: (json['only_new_members'] as bool?) ?? false,
    hasPublicWinners: (json['has_public_winners'] as bool?) ?? false,
    countryCodes: List<String>.from(
      tdListFromJson(
        json['country_codes'],
      ).map((item) => (item as dynamic)?.toString() ?? ''),
    ),
    prizeDescription: (json['prize_description'] as String?) ?? '',
  );
}