Chat.fromMap constructor

Chat.fromMap(
  1. Map<String, dynamic> map
)

Implementation

Chat.fromMap(Map<String, dynamic> map) {
  extra = map['@extra'];
  client_id = map['@client_id'];
  id = map['id'];
  if (map['type'] != null) {
    type = TdApiMap.fromMap(map['type']) as ChatType;
  }
  title = map['title'];
  if (map['photo'] != null) {
    photo = TdApiMap.fromMap(map['photo']) as ChatPhotoInfo;
  }
  if (map['permissions'] != null) {
    permissions = TdApiMap.fromMap(map['permissions']) as ChatPermissions;
  }
  if (map['last_message'] != null) {
    last_message = TdApiMap.fromMap(map['last_message']) as Message;
  }
  if (map['positions'] != null) {
    positions = [];
    for (var someValue in map['positions']) {
      if (someValue != null) {
        positions?.add(TdApiMap.fromMap(someValue) as ChatPosition);
      }
    }
  }
  if (map['message_sender_id'] != null) {
    message_sender_id = TdApiMap.fromMap(map['message_sender_id']) as MessageSender;
  }
  has_protected_content = map['has_protected_content'];
  is_marked_as_unread = map['is_marked_as_unread'];
  is_blocked = map['is_blocked'];
  has_scheduled_messages = map['has_scheduled_messages'];
  can_be_deleted_only_for_self = map['can_be_deleted_only_for_self'];
  can_be_deleted_for_all_users = map['can_be_deleted_for_all_users'];
  can_be_reported = map['can_be_reported'];
  default_disable_notification = map['default_disable_notification'];
  unread_count = map['unread_count'];
  last_read_inbox_message_id = map['last_read_inbox_message_id'];
  last_read_outbox_message_id = map['last_read_outbox_message_id'];
  unread_mention_count = map['unread_mention_count'];
  unread_reaction_count = map['unread_reaction_count'];
  if (map['notification_settings'] != null) {
    notification_settings = TdApiMap.fromMap(map['notification_settings']) as ChatNotificationSettings;
  }
  if (map['available_reactions'] != null) {
    available_reactions = TdApiMap.fromMap(map['available_reactions']) as ChatAvailableReactions;
  }
  message_auto_delete_time = map['message_auto_delete_time'];
  theme_name = map['theme_name'];
  if (map['action_bar'] != null) {
    action_bar = TdApiMap.fromMap(map['action_bar']) as ChatActionBar;
  }
  if (map['video_chat'] != null) {
    video_chat = TdApiMap.fromMap(map['video_chat']) as VideoChat;
  }
  if (map['pending_join_requests'] != null) {
    pending_join_requests = TdApiMap.fromMap(map['pending_join_requests']) as ChatJoinRequestsInfo;
  }
  reply_markup_message_id = map['reply_markup_message_id'];
  if (map['draft_message'] != null) {
    draft_message = TdApiMap.fromMap(map['draft_message']) as DraftMessage;
  }
  client_data = map['client_data'];
}