fromJson static method
Creates a object from a json
Implementation
static Message fromJson(Map<String, dynamic> json) {
return Message(
messageId: json['message_id']!,
messageThreadId: json['message_thread_id'],
from: callIfNotNull(User.fromJson, json['from']),
senderChat: callIfNotNull(Chat.fromJson, json['sender_chat']),
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'],
isTopicMessage: json['is_topic_message'],
isAutomaticForward: json['is_automatic_forward'],
replyToMessage: callIfNotNull(
Message.fromJson,
json['reply_to_message'],
),
viaBot: callIfNotNull(User.fromJson, json['via_bot']),
editDate: json['edit_date'],
hasProtectedContent: json['has_protected_content'],
mediaGroupId: json['media_group_id'],
authorSignature: json['author_signature'],
text: json['text'],
entities: callIfNotNull(
MessageEntity.listFromJsonArray,
json['entities'],
),
animation: callIfNotNull(Animation.fromJson, json['animation']),
audio: callIfNotNull(Audio.fromJson, json['audio']),
document: callIfNotNull(Document.fromJson, json['document']),
photo: callIfNotNull(PhotoSize.listFromJsonArray, json['photo']),
sticker: callIfNotNull(Sticker.fromJson, json['sticker']),
story: callIfNotNull(Story.fromJson, json['story']),
video: callIfNotNull(Video.fromJson, json['video']),
videoNote: callIfNotNull(VideoNote.fromJson, json['video_note']),
voice: callIfNotNull(Voice.fromJson, json['voice']),
caption: json['caption'],
captionEntities: callIfNotNull(
MessageEntity.listFromJsonArray,
json['caption_entities'],
),
hasMediaSpoiler: json['has_media_spoiler'],
contact: callIfNotNull(Contact.fromJson, json['contact']),
dice: callIfNotNull(Dice.fromJson, json['dice']),
game: callIfNotNull(Game.fromJson, json['game']),
poll: callIfNotNull(Poll.fromJson, json['poll']),
venue: callIfNotNull(Venue.fromJson, json['venue']),
location: callIfNotNull(Location.fromJson, json['location']),
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'],
),
userShared: callIfNotNull(
UserShared.fromJson,
json['user_shared'],
),
chatShared: callIfNotNull(
ChatShared.fromJson,
json['chat_shared'],
),
connectedWebsite: json['connected_website'],
passportData: callIfNotNull(
PassportData.fromJson,
json['passport_data'],
),
proximityAlertTriggered: callIfNotNull(
ProximityAlertTriggered.fromJson,
json['proximity_alert_triggered'],
),
forumTopicCreated: callIfNotNull(
ForumTopicCreated.fromJson,
json['forum_topic_created'],
),
forumTopicClosed: callIfNotNull(
ForumTopicClosed.fromJson,
json['forum_topic_closed'],
),
forumTopicReopened: callIfNotNull(
ForumTopicReopened.fromJson,
json['forum_topic_reopened'],
),
videoChatScheduled: callIfNotNull(
VideoChatScheduled.fromJson,
json['video_chat_scheduled'],
),
videoChatStarted: callIfNotNull(
VideoChatStarted.fromJson,
json['video_chat_started'],
),
videoChatEnded: callIfNotNull(
VideoChatEnded.fromJson,
json['video_chat_ended'],
),
videoChatParticipantsInvited: callIfNotNull(
VideoChatParticipantsInvited.fromJson,
json['video_chat_participants_invited'],
),
webAppData: callIfNotNull(
WebAppData.fromJson,
json['web_app_data'],
),
replyMarkup: callIfNotNull(
InlineKeyboardMarkup.fromJson,
json['reply_markup'],
),
);
}