V2TIM_CONVERSATION_MARK_TYPE_UNREAD
, the unread count at the underlying layer will not change.Attribute | Definition | Description |
conversationIDList | List of conversation IDs | Up to 100 conversations can be marked at a time. |
markType | Mark type | A conversation can be marked as a favorite, unread, collapsed, or hidden. |
enableMark | Mark/Unmark | A conversation can be marked/unmarked. |
32 ≤ n < 64
indicates that n
must be equal to or greater than 32 and less than 64). For example, 0x1LL << 32
indicates "Online on an iPhone".// Mark a conversationV2TimValueCallback<List<V2TimConversationOperationResult>>markConversationRes = await TencentImSDKPlugin.v2TIMManager.getConversationManager().markConversation(markType: 0,// Mark typeenableMark: true,// Whether to support the marking featureconversationIDList: []);// List of IDs of the conversations to be markedif (markConversationRes.code == 0) {// Marked successfullymarkConversationRes.data?.forEach((element) {element.conversationID; // ID of the conversation markedelement.resultCode; // Operation result error code of the conversationelement.resultInfo; // Operation result description of the conversation});}
markList
field (dart) in V2TimConversation
of the conversation will change. You can call the addConversationListener
(dart) API to listen for such a change notification.// Set the conversation listenerV2TimConversationListener listener = V2TimConversationListener(onConversationChanged: (List<V2TimConversation> conversationList) => {// If the key information of some conversations changes (for example, the unread count changes, or the last message is updated), use "lastMessage -> timestamp" to sort the conversation list again.// conversationList: List of conversations that have changes});// Add a conversation listenerTencentImSDKPlugin.v2TIMManager.getConversationManager().addConversationListener(listener: listener); // Conversation listener to add
// Get the conversation listV2TimConversationListFilter filter = V2TimConversationListFilter(conversationType: 0, // Conversation typenextSeq: 0,// Pull cursorcount: 10,// Pull countmarkType: 0,// Conversation mark typegroupName: "groupName");// Name of the pulled group// Advanced API for getting the conversation listV2TimValueCallback<V2TimConversationResult> getConversationListByFilterRes =await TencentImSDKPlugin.v2TIMManager.getConversationManager().getConversationListByFilter(filter: filter);// Conversation list filterif (getConversationListByFilterRes.code == 0) {// Pulled successfullybool? isFinished =getConversationListByFilterRes.data?.isFinished; //Whether the list is fully pulledString? nextSeq =getConversationListByFilterRes.data?.nextSeq; // Cursor for the subsequent paged pullList<V2TimConversation?>? conversationList =getConversationListByFilterRes.data?.conversationList; // List of conversations pulled this time// If more conversations need to be pulled, use the returned `nextSeq` to continue pulling until `isFinished` is `true`.if (!isFinished!) {V2TimConversationListFilter nextFilter = V2TimConversationListFilter(conversationType: 0,nextSeq: int.parse(nextSeq!),// Use the returned `nextSeq` to continue pulling until `isFinished` is `true`.count: 10,markType: 0,groupName: "groupName");V2TimValueCallback<V2TimConversationResult> nextConversationListRes =await TencentImSDKPlugin.v2TIMManager.getConversationManager().getConversationListByFilter(filter: nextFilter);}getConversationListByFilterRes.data?.conversationList?.forEach((element) {element?.conversationID; // Unique conversation ID. It is in the format of `c2c_userID` for a one-to-one chat or `group_groupID` for a group chat.element?.draftText; // Draft messageelement?.draftTimestamp; // Draft editing time. It is automatically generated when a draft is set.element?.faceUrl; // Displayed conversation profile photo. It is the group profile photo for a group chat or the profile photo of the message receiver for a one-to-one chat.element?.groupAtInfoList; // List of @ information in the group conversation. Generally, it is used to display the notifications of "someone@me" and "@all".element?.groupID; // ID of the current group. If the conversation type is group chat, `groupID` is the ID of the current group. Otherwise, it is `null`.element?.groupType; // Type of the current group. If the conversation type is group chat, `groupType` is the type of the current group. Otherwise, it is `null`.element?.isPinned; // Whether the conversation is pinned to the topelement?.lastMessage; // Last message in the conversationelement?.orderkey; // Field for sorting conversationselement?.recvOpt; // Message receiving optionelement?.showName; // Displayed conversation name. The name of a group chat is displayed in the following order of priority: group name > group ID. The name of a one-to-one chat is displayed in the following order of priority: friend remarks of the message receiver > nickname of the message receiver > `userID` of the message receiver.element?.type; // Conversation type, which can be `C2C` (one-to-one chat) or `Group` (group chat).element?.unreadCount; // Unread message count of the conversation. It is invalid and defaults to `0` for an audio-video group (AVChatRoom).element?.userID; // User ID of the message receiver. If the conversation type is one-to-one chat, `userID` is the user ID of the message receiver. Otherwise, it is `null`.});}
Was this page helpful?