fromJson static method
Implementation
static UpgradedGift? fromJson(Map<String, dynamic>? json) {
if (json == null) {
return null;
}
return UpgradedGift(
id: (json['id'] is int
? json['id'] as int
: int.tryParse(json['id']?.toString() ?? '')) ??
0,
regularGiftId: (json['regular_gift_id'] is int
? json['regular_gift_id'] as int
: int.tryParse(json['regular_gift_id']?.toString() ?? '')) ??
0,
publisherChatId: (json['publisher_chat_id'] as int?) ?? 0,
title: (json['title'] as String?) ?? '',
name: (json['name'] as String?) ?? '',
number: (json['number'] as int?) ?? 0,
totalUpgradedCount: (json['total_upgraded_count'] as int?) ?? 0,
maxUpgradedCount: (json['max_upgraded_count'] as int?) ?? 0,
isBurned: (json['is_burned'] as bool?) ?? false,
isCrafted: (json['is_crafted'] as bool?) ?? false,
isPremium: (json['is_premium'] as bool?) ?? false,
isThemeAvailable: (json['is_theme_available'] as bool?) ?? false,
usedThemeChatId: (json['used_theme_chat_id'] as int?) ?? 0,
hostId: MessageSender.fromJson(json['host_id'] as Map<String, dynamic>?),
ownerId:
MessageSender.fromJson(json['owner_id'] as Map<String, dynamic>?),
ownerAddress: (json['owner_address'] as String?) ?? '',
ownerName: (json['owner_name'] as String?) ?? '',
giftAddress: (json['gift_address'] as String?) ?? '',
canBeTonWalletCardBackground:
(json['can_be_ton_wallet_card_background'] as bool?) ?? false,
model:
UpgradedGiftModel.fromJson(json['model'] as Map<String, dynamic>?)!,
symbol:
UpgradedGiftSymbol.fromJson(json['symbol'] as Map<String, dynamic>?)!,
backdrop: UpgradedGiftBackdrop.fromJson(
json['backdrop'] as Map<String, dynamic>?)!,
originalDetails: UpgradedGiftOriginalDetails.fromJson(
json['original_details'] as Map<String, dynamic>?),
colors:
UpgradedGiftColors.fromJson(json['colors'] as Map<String, dynamic>?),
resaleParameters: GiftResaleParameters.fromJson(
json['resale_parameters'] as Map<String, dynamic>?),
canSendPurchaseOffer: (json['can_send_purchase_offer'] as bool?) ?? false,
craftProbabilityPerMille:
(json['craft_probability_per_mille'] as int?) ?? 0,
valueCurrency: (json['value_currency'] as String?) ?? '',
valueAmount: (json['value_amount'] as int?) ?? 0,
valueUsdAmount: (json['value_usd_amount'] as int?) ?? 0,
);
}