Chat.fromJson constructor

Chat.fromJson(
  1. Map<String, dynamic> json
)

Parses a Chat from TDLib JSON.

Implementation

factory Chat.fromJson(Map<String, dynamic> json) => Chat(
  id: _readInt(json['id']),
  type: _readObject(json['type'], ChatType.fromJson),
  title: _readString(json['title']),
  photo: _readOptional(json['photo'], ChatPhotoInfo.fromJson),
  accentColorId: _readInt(json['accent_color_id']),
  backgroundCustomEmojiId: _readInt(json['background_custom_emoji_id']),
  upgradedGiftColors: _readOptional(
    json['upgraded_gift_colors'],
    UpgradedGiftColors.fromJson,
  ),
  profileAccentColorId: _readInt(json['profile_accent_color_id']),
  profileBackgroundCustomEmojiId: _readInt(
    json['profile_background_custom_emoji_id'],
  ),
  permissions: _readObject(json['permissions'], ChatPermissions.fromJson),
  lastMessage: _readOptional(json['last_message'], Message.fromJson),
  positions: _readList<ChatPosition>(
    json['positions'],
    (e) => _readObject(e, ChatPosition.fromJson),
  ),
  chatLists: _readList<ChatList>(
    json['chat_lists'],
    (e) => _readObject(e, ChatList.fromJson),
  ),
  messageSenderId: _readOptional(
    json['message_sender_id'],
    MessageSender.fromJson,
  ),
  blockList: _readOptional(json['block_list'], BlockList.fromJson),
  hasProtectedContent: _readBool(json['has_protected_content']),
  isTranslatable: _readBool(json['is_translatable']),
  isMarkedAsUnread: _readBool(json['is_marked_as_unread']),
  viewAsTopics: _readBool(json['view_as_topics']),
  hasScheduledMessages: _readBool(json['has_scheduled_messages']),
  hasWelcomeMessages: _readBool(json['has_welcome_messages']),
  canBeDeletedOnlyForSelf: _readBool(json['can_be_deleted_only_for_self']),
  canBeDeletedForAllUsers: _readBool(json['can_be_deleted_for_all_users']),
  canBeReported: _readBool(json['can_be_reported']),
  defaultDisableNotification: _readBool(json['default_disable_notification']),
  unreadCount: _readInt(json['unread_count']),
  lastReadInboxMessageId: _readInt(json['last_read_inbox_message_id']),
  lastReadOutboxMessageId: _readInt(json['last_read_outbox_message_id']),
  unreadMentionCount: _readInt(json['unread_mention_count']),
  unreadReactionCount: _readInt(json['unread_reaction_count']),
  unreadPollVoteCount: _readInt(json['unread_poll_vote_count']),
  notificationSettings: _readObject(
    json['notification_settings'],
    ChatNotificationSettings.fromJson,
  ),
  availableReactions: _readObject(
    json['available_reactions'],
    ChatAvailableReactions.fromJson,
  ),
  messageAutoDeleteTime: _readInt(json['message_auto_delete_time']),
  emojiStatus: _readOptional(json['emoji_status'], EmojiStatus.fromJson),
  background: _readOptional(json['background'], ChatBackground.fromJson),
  theme: _readOptional(json['theme'], ChatTheme.fromJson),
  actionBar: _readOptional(json['action_bar'], ChatActionBar.fromJson),
  businessBotManageBar: _readOptional(
    json['business_bot_manage_bar'],
    BusinessBotManageBar.fromJson,
  ),
  videoChat: _readObject(json['video_chat'], VideoChat.fromJson),
  pendingJoinRequests: _readOptional(
    json['pending_join_requests'],
    ChatJoinRequestsInfo.fromJson,
  ),
  replyMarkupMessageId: _readInt(json['reply_markup_message_id']),
  draftMessage: _readOptional(json['draft_message'], DraftMessage.fromJson),
  clientData: _readString(json['client_data']),
  extra: json['@extra'],
  clientId: _readClientId(json['@client_id']),
);