fromMap static method
override
Construct from Map.
Implementation
static Chat? 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 type = ChatType.fromMap(_map['type'])!;
var title = _map['title']! as String;
var photo = ChatPhotoInfo.fromMap(_map['photo']);
var permissions = ChatPermissions.fromMap(_map['permissions'])!;
var last_message = Message.fromMap(_map['last_message']);
var positions = List<ChatPosition>.from(
(_map["positions"] ?? []).map(
(e) => ChatPosition.fromMap(e),
),
);
var message_sender_id = MessageSender.fromMap(_map['message_sender_id']);
var block_list = BlockList.fromMap(_map['block_list']);
var has_protected_content = _map['has_protected_content']! as bool;
var is_translatable = _map['is_translatable']! as bool;
var is_marked_as_unread = _map['is_marked_as_unread']! as bool;
var has_scheduled_messages = _map['has_scheduled_messages']! 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_be_reported = _map['can_be_reported']! as bool;
var default_disable_notification =
_map['default_disable_notification']! as bool;
var unread_count = _map['unread_count']! as int;
var last_read_inbox_message_id = _map['last_read_inbox_message_id']! as int;
var last_read_outbox_message_id =
_map['last_read_outbox_message_id']! as int;
var unread_mention_count = _map['unread_mention_count']! as int;
var unread_reaction_count = _map['unread_reaction_count']! as int;
var notification_settings =
ChatNotificationSettings.fromMap(_map['notification_settings'])!;
var available_reactions =
ChatAvailableReactions.fromMap(_map['available_reactions'])!;
var message_auto_delete_time = _map['message_auto_delete_time']! as int;
var background = ChatBackground.fromMap(_map['background']);
var theme_name = _map['theme_name']! as String;
var action_bar = ChatActionBar.fromMap(_map['action_bar']);
var video_chat = VideoChat.fromMap(_map['video_chat'])!;
var pending_join_requests =
ChatJoinRequestsInfo.fromMap(_map['pending_join_requests']);
var reply_markup_message_id = _map['reply_markup_message_id']! as int;
var draft_message = DraftMessage.fromMap(_map['draft_message']);
var client_data = _map['client_data']! as String;
return Chat(
extra: extra,
clientId: clientId,
id: id,
type: type,
title: title,
photo: photo,
permissions: permissions,
last_message: last_message,
positions: positions,
message_sender_id: message_sender_id,
block_list: block_list,
has_protected_content: has_protected_content,
is_translatable: is_translatable,
is_marked_as_unread: is_marked_as_unread,
has_scheduled_messages: has_scheduled_messages,
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_be_reported: can_be_reported,
default_disable_notification: default_disable_notification,
unread_count: unread_count,
last_read_inbox_message_id: last_read_inbox_message_id,
last_read_outbox_message_id: last_read_outbox_message_id,
unread_mention_count: unread_mention_count,
unread_reaction_count: unread_reaction_count,
notification_settings: notification_settings,
available_reactions: available_reactions,
message_auto_delete_time: message_auto_delete_time,
background: background,
theme_name: theme_name,
action_bar: action_bar,
video_chat: video_chat,
pending_join_requests: pending_join_requests,
reply_markup_message_id: reply_markup_message_id,
draft_message: draft_message,
client_data: client_data,
);
}