ChatManager class Null safety

The chat manager class, responsible for sending and receiving messages, loading and deleting conversations, and downloading attachments.

The sample code for sending a text message:

   ChatMessage msg = ChatMessage.createTxtSendMessage(
       username: toChatUsername, content: content);
   await ChatClient.getInstance.chatManager.sendMessage(msg);

Properties

hashCode int
The hash code for this object.
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addChatManagerListener(ChatManagerListener listener) → void
Adds the chat manager listener. After calling this method, you can listen for new messages when they arrive.
addReaction({required String messageId, required String reaction}) Future<void>
/ Reaction
clearAllChatManagerListeners() → void
Removes all chat manager listeners.
deleteConversation(String conversationId, {bool deleteMessages = true}) Future<bool>
Deletes a conversation and its related messages from the local database.
deleteRemoteConversation(String conversationId, {ChatConversationType conversationType = ChatConversationType.Chat, bool isDeleteMessage = true}) Future<void>
Deletes the specified conversation and the related historical messages from the server.
downloadAttachment(ChatMessage message) Future<void>
Downloads the attachment files from the server.
downloadThumbnail(ChatMessage message) Future<void>
Downloads the thumbnail if the message has not been downloaded before or if the download fails.
fetchGroupAcks(String msgId, String groupId, {String? startAckId, int pageSize = 0}) Future<ChatCursorResult<ChatGroupMessageAck>>
Gets read receipts for group messages from the server with pagination.
fetchHistoryMessages({required String conversationId, ChatConversationType type = ChatConversationType.Chat, int pageSize = 20, String startMsgId = ''}) Future<ChatCursorResult<ChatMessage>>
Gets historical messages of the conversation from the server with pagination.
fetchReactionDetail({required String messageId, required String reaction, String? cursor, int pageSize = 20}) Future<ChatCursorResult<ChatMessageReaction>>
Gets the reaction details.
fetchReactionList({required List<String> messageIds, required ChatType chatType, String? groupId}) Future<Map<String, List<ChatMessageReaction>>>
Gets the list of Reactions.
fetchSupportedLanguages() Future<List<ChatTranslateLanguage>>
Fetch all languages what the translate service support
getConversation(String conversationId, {ChatConversationType type = ChatConversationType.Chat, bool createIfNeed = true}) Future<ChatConversation?>
Gets the conversation by conversation ID and conversation type.
getConversationsFromServer() Future<List<ChatConversation>>
Gets the conversation list from the server.
getUnreadMessageCount() Future<int>
Gets the count of the unread messages.
importMessages(List<ChatMessage> messages) Future<void>
Imports messages to the local database.
loadAllConversations() Future<List<ChatConversation>>
Gets all conversations from the local database.
loadMessage(String messageId) Future<ChatMessage?>
Loads a message from the local database by message ID.
markAllConversationsAsRead() Future<void>
Marks all messages as read.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
recallMessage(String messageId) Future<void>
Recalls the sent message.
removeChatManagerListener(ChatManagerListener listener) → void
Removes the chat manager listener.
removeReaction({required String messageId, required String reaction}) Future<void>
Deletes a reaction.
reportMessage({required String messageId, required String tag, required String reason}) Future<void>
// Moderation
resendMessage(ChatMessage message) Future<ChatMessage>
Resend a message.
searchMsgFromDB(String keywords, {int timeStamp = -1, int maxCount = 20, String from = '', ChatSearchDirection direction = ChatSearchDirection.Up}) Future<List<ChatMessage>>
Retrieves messages from the database according to the parameters.
sendConversationReadAck(String conversationId) Future<bool>
Sends the conversation read receipt to the server. This method is only for one-to-one chat conversations.
sendGroupMessageReadAck(String msgId, String groupId, {String? content}) Future<bool>
Sends the group message receipt to the server.
sendMessage(ChatMessage message) Future<ChatMessage>
Sends a message.
sendMessageReadAck(ChatMessage message) Future<bool>
Sends the read receipt to the server.
toString() String
A string representation of this object.
inherited
translateMessage({required ChatMessage msg, required List<String> languages}) Future<ChatMessage>
Translate a message.
updateMessage(ChatMessage message) Future<void>
Updates the local message.

Operators

operator ==(Object other) bool
The equality operator.
inherited