fromMap static method
override
Construct from Map.
Implementation
static Message? fromMap(Map<String, dynamic>? _map) {
if (_map == null) return null;
var _ = _map["@type"];
if (_ != CONSTRUCTOR) return null;
var extra = _map['@extra'];
var clientId = _map['@clientId'];
var id = _map['id']! as int;
var sender_id = MessageSender.fromMap(_map['sender_id'])!;
var chat_id = _map['chat_id']! as int;
var sending_state = MessageSendingState.fromMap(_map['sending_state']);
var scheduling_state =
MessageSchedulingState.fromMap(_map['scheduling_state']);
var is_outgoing = _map['is_outgoing']! as bool;
var is_pinned = _map['is_pinned']! as bool;
var can_be_edited = _map['can_be_edited']! as bool;
var can_be_forwarded = _map['can_be_forwarded']! as bool;
var can_be_saved = _map['can_be_saved']! as bool;
var can_be_deleted_only_for_self =
_map['can_be_deleted_only_for_self']! as bool;
var can_be_deleted_for_all_users =
_map['can_be_deleted_for_all_users']! as bool;
var can_get_added_reactions = _map['can_get_added_reactions']! as bool;
var can_get_statistics = _map['can_get_statistics']! as bool;
var can_get_message_thread = _map['can_get_message_thread']! as bool;
var can_get_viewers = _map['can_get_viewers']! as bool;
var can_get_media_timestamp_links =
_map['can_get_media_timestamp_links']! as bool;
var can_report_reactions = _map['can_report_reactions']! as bool;
var has_timestamped_media = _map['has_timestamped_media']! as bool;
var is_channel_post = _map['is_channel_post']! as bool;
var is_topic_message = _map['is_topic_message']! as bool;
var contains_unread_mention = _map['contains_unread_mention']! as bool;
var date = _map['date']! as int;
var edit_date = _map['edit_date']! as int;
var forward_info = MessageForwardInfo.fromMap(_map['forward_info']);
var interaction_info =
MessageInteractionInfo.fromMap(_map['interaction_info']);
var unread_reactions = List<UnreadReaction>.from(
(_map["unread_reactions"] ?? []).map(
(e) => UnreadReaction.fromMap(e),
),
);
var reply_to = MessageReplyTo.fromMap(_map['reply_to']);
var message_thread_id = _map['message_thread_id']! as int;
var self_destruct_type =
MessageSelfDestructType.fromMap(_map['self_destruct_type']);
var self_destruct_in = _map['self_destruct_in']! as double;
var auto_delete_in = _map['auto_delete_in']! as double;
var via_bot_user_id = _map['via_bot_user_id']! as int;
var author_signature = _map['author_signature']! as String;
var media_album_id = _map['media_album_id']! as int64;
var restriction_reason = _map['restriction_reason']! as String;
var content = MessageContent.fromMap(_map['content'])!;
var reply_markup = ReplyMarkup.fromMap(_map['reply_markup']);
return Message(
extra: extra,
clientId: clientId,
id: id,
sender_id: sender_id,
chat_id: chat_id,
sending_state: sending_state,
scheduling_state: scheduling_state,
is_outgoing: is_outgoing,
is_pinned: is_pinned,
can_be_edited: can_be_edited,
can_be_forwarded: can_be_forwarded,
can_be_saved: can_be_saved,
can_be_deleted_only_for_self: can_be_deleted_only_for_self,
can_be_deleted_for_all_users: can_be_deleted_for_all_users,
can_get_added_reactions: can_get_added_reactions,
can_get_statistics: can_get_statistics,
can_get_message_thread: can_get_message_thread,
can_get_viewers: can_get_viewers,
can_get_media_timestamp_links: can_get_media_timestamp_links,
can_report_reactions: can_report_reactions,
has_timestamped_media: has_timestamped_media,
is_channel_post: is_channel_post,
is_topic_message: is_topic_message,
contains_unread_mention: contains_unread_mention,
date: date,
edit_date: edit_date,
forward_info: forward_info,
interaction_info: interaction_info,
unread_reactions: unread_reactions,
reply_to: reply_to,
message_thread_id: message_thread_id,
self_destruct_type: self_destruct_type,
self_destruct_in: self_destruct_in,
auto_delete_in: auto_delete_in,
via_bot_user_id: via_bot_user_id,
author_signature: author_signature,
media_album_id: media_album_id,
restriction_reason: restriction_reason,
content: content,
reply_markup: reply_markup,
);
}