toJson method
Returns the JSON representation of the Message object.
Implementation
@override
Map<String, dynamic> toJson() {
return {
'message_id': messageId,
'from': from?.toJson(),
'sender_chat': senderChat?.toJson(),
'date': date,
'chat': chat.toJson(),
'reply_to_message': replyToMessage?.toJson(),
'via_bot': viaBot?.toJson(),
'edit_date': editDate,
'media_group_id': mediaGroupId,
'author_signature': authorSignature,
'text': text,
'entities': entities?.map((e) => e.toJson()).toList(),
'animation': animation?.toJson(),
'audio': audio?.toJson(),
'document': document?.toJson(),
'photo': photo?.map((e) => e.toJson()).toList(),
'sticker': sticker?.toJson(),
'video': video?.toJson(),
'video_note': videoNote?.toJson(),
'voice': voice?.toJson(),
'caption': caption,
'caption_entities': captionEntities?.map((e) => e.toJson()).toList(),
'contact': contact?.toJson(),
'dice': dice?.toJson(),
'game': game?.toJson(),
'poll': poll?.toJson(),
'venue': venue?.toJson(),
'location': location?.toJson(),
'new_chat_members': newChatMembers?.map((e) => e.toJson()).toList(),
'left_chat_member': leftChatMember?.toJson(),
'new_chat_title': newChatTitle,
'new_chat_photo': newChatPhoto?.map((e) => e.toJson()).toList(),
'delete_chat_photo': deleteChatPhoto,
'group_chat_created': groupChatCreated,
'supergroup_chat_created': supergroupChatCreated,
'channel_chat_created': channelChatCreated,
'message_auto_delete_timer_changed':
messageAutoDeleteTimerChanged?.toJson(),
'migrate_to_chat_id': migrateToChatId,
'migrate_from_chat_id': migrateFromChatId,
'pinned_message': pinnedMessage?.toJson(),
'invoice': invoice?.toJson(),
'successful_payment': successfulPayment?.toJson(),
'connected_website': connectedWebsite,
'passport_data': passportData?.toJson(),
'proximity_alert_triggered': proximityAlertTriggered?.toJson(),
'reply_markup': replyMarkup?.toJson(),
'is_automatic_forward': isAutomaticForward,
'web_app_data': webAppData?.toJson(),
'video_chat_ended': videoChatEnded?.toJson(),
'video_chat_started': videoChatStarted?.toJson(),
'video_chat_participants_invited': videoChatParticipantsInvited?.toJson(),
'video_chat_scheduled': videoChatScheduled?.toJson(),
'forum_topic_closed': forumTopicClosed?.toJson(),
'forum_topic_created': forumTopicCreated?.toJson(),
'forum_topic_reopened': forumTopicReopened?.toJson(),
'has_protected_content': hasProtectedContent,
'is_topic_message': isTopicMessage,
'message_thread_id': messageThreadId,
'users_shared': usersShared?.toJson(),
'chat_shared': chatShared?.toJson(),
'has_media_spoiler': hasMediaSpoiler,
'forum_topic_edited': forumTopicEdited?.toJson(),
'general_forum_topic_hidden': generalForumTopicHidden?.toJson(),
'general_forum_topic_unhidden': generalForumTopicUnhidden?.toJson(),
'write_access_allowed': writeAccessAllowed?.toJson(),
'story': story?.toJson(),
'external_reply': externalReply?.toJson(),
'quote': quote?.toJson(),
'link_preview_options': linkPreviewOptions?.toJson(),
'giveaway': giveaway?.toJson(),
'giveaway_created': giveawayCreated?.toJson(),
'giveaway_winners': giveawayWinners?.toJson(),
'giveaway_completed': giveawayCompleted?.toJson(),
'forward_origin': forwardOrigin?.toJson(),
'boost_added': boostAdded?.toJson(),
'sender_boost_count': senderBoostCount,
'reply_to_story': replyToStory?.toJson(),
'business_connection_id': businessConnectionId,
'sender_business_bot': senderBusinessBot?.toJson(),
'is_from_offline': isFromOffline,
'chat_background_set': chatBackgroundSet?.toJson(),
'effect_id': effectId,
'show_caption_above_media': showCaptionAboveMedia,
'paid_media': paidMedia?.toJson(),
'refunded_payment': refundedPayment?.toJson(),
}..removeWhere(_nullFilter);
}