fromJson static method
Implementation
static ReceivedGift? fromJson(Map<String, dynamic>? json) {
if (json == null) {
return null;
}
return ReceivedGift(
receivedGiftId: (json['received_gift_id'] as String?) ?? '',
senderId: MessageSender.fromJson(tdMapFromJson(json['sender_id'])),
text: FormattedText.fromJson(tdMapFromJson(json['text'])),
uniqueGiftNumber: (json['unique_gift_number'] as int?) ?? 0,
isPrivate: (json['is_private'] as bool?) ?? false,
isSaved: (json['is_saved'] as bool?) ?? false,
isPinned: (json['is_pinned'] as bool?) ?? false,
canBeUpgraded: (json['can_be_upgraded'] as bool?) ?? false,
canBeTransferred: (json['can_be_transferred'] as bool?) ?? false,
wasRefunded: (json['was_refunded'] as bool?) ?? false,
date: (json['date'] as int?) ?? 0,
gift: SentGift.fromJson(tdMapFromJson(json['gift'])),
collectionIds: List<int>.from(
tdListFromJson(
json['collection_ids'],
).map((item) => int.tryParse((item as dynamic)?.toString() ?? '') ?? 0),
),
sellStarCount: (json['sell_star_count'] as int?) ?? 0,
prepaidUpgradeStarCount:
(json['prepaid_upgrade_star_count'] as int?) ?? 0,
isUpgradeSeparate: (json['is_upgrade_separate'] as bool?) ?? false,
transferStarCount: (json['transfer_star_count'] as int?) ?? 0,
dropOriginalDetailsStarCount:
(json['drop_original_details_star_count'] as int?) ?? 0,
nextTransferDate: (json['next_transfer_date'] as int?) ?? 0,
nextResaleDate: (json['next_resale_date'] as int?) ?? 0,
exportDate: (json['export_date'] as int?) ?? 0,
prepaidUpgradeHash: (json['prepaid_upgrade_hash'] as String?) ?? '',
craftDate: (json['craft_date'] as int?) ?? 0,
);
}