fromJson static method
Implementation
static Message fromJson(Map<String, dynamic> json) {
return Message(
messageId: json['message_id']!,
from: callIfNotNull(User.fromJson, json['from']),
date: json['date']!,
chat: Chat.fromJson(json['chat']!),
forwardFrom: callIfNotNull(User.fromJson, json['forward_from']),
forwardFromChat: callIfNotNull(
Chat.fromJson,
json['forward_from_chat'],
),
forwardFromMessageId: json['forward_from_message_id'],
forwardSignature: json['forward_signature'],
forwardSenderName: json['forward_sender_name'],
forwardDate: json['forward_date'],
replyToMessage: callIfNotNull(
Message.fromJson,
json['reply_to_message'],
),
editDate: json['edit_date'],
mediaGroupId: json['media_group_id'],
authorSignature: json['author_signature'],
text: json['text'],
entities: callIfNotNull(
MessageEntity.listFromJsonArray,
json['entities'],
),
captionEntities: callIfNotNull(
MessageEntity.listFromJsonArray,
json['caption_entities'],
),
audio: callIfNotNull(Audio.fromJson, json['audio']),
document: callIfNotNull(Document.fromJson, json['document']),
animation: callIfNotNull(Animation.fromJson, json['animation']),
game: callIfNotNull(Game.fromJson, json['game']),
photo: callIfNotNull(PhotoSize.listFromJsonArray, json['photo']),
sticker: callIfNotNull(Sticker.fromJson, json['sticker']),
video: callIfNotNull(Video.fromJson, json['video']),
voice: callIfNotNull(Voice.fromJson, json['voice']),
videoNote: callIfNotNull(VideoNote.fromJson, json['video_note']),
caption: json['caption'],
contact: callIfNotNull(Contact.fromJson, json['contact']),
location: callIfNotNull(Location.fromJson, json['location']),
venue: callIfNotNull(Venue.fromJson, json['venue']),
poll: callIfNotNull(Poll.fromJson, json['poll']),
newChatMembers: callIfNotNull(
User.listFromJsonArray,
json['new_chat_members'],
),
leftChatMember: callIfNotNull(User.fromJson, json['left_chat_member']),
newChatTitle: json['new_chat_title'],
newChatPhoto: callIfNotNull(
PhotoSize.listFromJsonArray,
json['new_chat_photo'],
),
deleteChatPhoto: json['delete_chat_photo'],
groupChatCreated: json['group_chat_created'],
supergroupChatCreated: json['supergroup_chat_created'],
channelChatCreated: json['channel_chat_created'],
messageAutoDeleteTimerChanged: callIfNotNull(
MessageAutoDeleteTimerChanged.fromJson,
json['message_auto_delete_timer_changed'],
),
migrateToChatId: json['migrate_to_chat_id'],
migrateFromChatId: json['migrate_from_chat_id'],
pinnedMessage: callIfNotNull(
Message.fromJson,
json['pinned_message'],
),
invoice: callIfNotNull(
Invoice.fromJson,
json['invoice'],
),
successfulPayment: callIfNotNull(
SuccessfulPayment.fromJson,
json['successful_payment'],
),
connectedWebsite: json['connected_website'],
passportData: callIfNotNull(
PassportData.fromJson,
json['passport_data'],
),
replyMarkup: callIfNotNull(
InlineKeyboardMarkup.fromJson,
json['reply_markup'],
),
);
}