Mark conversation as read
Mark messages in a specified conversation as read using the OpenIM Flutter SDK.
When a user enters a chat screen and views messages, call this method to clear the unread counter for that conversation:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | String | Yes | Target conversation ID. |
Code example
await OpenIM.iMManager.conversationManager.markConversationMessageAsRead(
conversationID: conversationID,
);Return value
A successful Future indicates that the mark-as-read request reached the server. The client should immediately reset the local conversation's unreadCount to 0.
State changes after the call
The SDK subsequently emits conversation change notifications. The client updates the conversation item using conversationID as the merge key. For complete listener integration, see Retrieve conversation list.
Single-chat C2C read receipts
In single-chat conversations, marking a conversation as read causes the counterparty to receive a read receipt notification via OnAdvancedMsgListener.onRecvC2CReadReceipt. When handling this callback, identify the corresponding conversationID from the counterparty's userID and update the read status of messages matching clientMsgID in msgIDList:
void handleC2CReadReceipts(List<ReadReceiptInfo> items) {
for (final receipt in items) {
mergeC2CReadReceipt(receipt);
}
}For centralized listener registration, see Events overview. The Flutter SDK does not provide member-level read receipts for group chats.
Was this page helpful?