Conversations overview
Understand the responsibilities of ConversationInfo, conversationID, conversation settings, and conversation events in the OpenIM Flutter SDK.
In OpenIMSDK, a conversation is client-side chat state maintained around one one-to-one or group chat. The current user has one ConversationInfo record for each conversation. It stores list state such as the unread count, latest message, pin state, draft, message receive option, and extension data. The conversation record and chat target have separate identifiers: conversationID locates the current account's conversation state, while a one-to-one target uses the other user's userID and a group target uses groupID.
Both one-to-one and group chats use conversation records for chat-list state. Group profiles, memberships, and permissions remain under the Group APIs. A group-chat page therefore uses groupID for group capabilities and conversationID for conversation settings, unread state, drafts, and message history.
Conversation identifiers
A one-to-one conversation uses the target user ID as sourceID and ConversationType.single as its type. A group conversation uses groupID as sourceID and ConversationType.superGroup as its type. Call getConversationIDBySessionType() to obtain the stable conversationID, then use it for settings, read state, hiding, and cleanup operations.
| Identifier | Purpose |
|---|---|
conversationID | Conversation-record ID for the current account, used for conversation settings, message history, and unread state. |
userID | User ID of the other participant in a one-to-one chat. |
groupID | Group ID of a group chat and the target identifier used by Group APIs. |
sourceID | Chat target passed to a type-based query: userID for one-to-one chats and groupID for group chats. |
ConversationInfo
Common ConversationInfo fields include:
| Field | Description |
|---|---|
conversationID | Conversation ID. |
conversationType | Conversation type. |
userID | Other participant's user ID in a one-to-one chat. |
groupID | Group ID in a group chat. |
showName | Current display name of the conversation. |
faceURL | Current display avatar of the conversation. |
unreadCount | Current conversation unread count. |
latestMsg | Latest message. |
latestMsgSendTime | Send time of the latest message. |
recvMsgOpt | Message receive option for this conversation. |
groupAtType | @ mention state in a group chat. |
draftText | Current conversation draft. |
draftTextTime | Time when the draft was updated. |
isPinned | Whether the conversation is pinned. |
isPrivateChat | Whether private-chat mode is enabled. |
isMsgDestruct | Whether message destruction is enabled. |
burnDuration | Burn-after-reading duration. |
msgDestructTime | Message-destruction time configuration. |
ex | Application-defined conversation extension string. |
Queries and settings
- Retrieve a specified conversation
- Retrieve conversations by ID
- Retrieve the conversation list
- Pin or unpin a conversation
- Set the conversation message receive option
- Enable or disable burn after reading
- Periodically delete server-side messages
- Reset group @ mention state
- Set the conversation extension field
- Set a conversation draft
- Mark a conversation as read
- Maintain the total unread count
Conversation lifecycle
Conversation groups
Conversation groups overview explains how to organize several conversations into custom groups. A group member is identified by conversationID, while the group itself uses conversationGroupID. This changes only how the current account organizes conversations; it does not create a chat group or alter a groupID, group profile, or group membership.
The Flutter SDK exposes this capability through ConversationGroupManager. Query results establish group snapshots. Group events update records by conversationGroupID, while member events use both conversationGroupID and conversationID. The overview contains the data model, complete listener, and links to each individual API page.
State updates
Queries establish page snapshots, and events merge subsequent changes:
- Retrieve the conversation list owns listeners for new conversations and conversation-property changes.
- Maintain the total unread count owns changes to the current account's total unread count.
This overview identifies event ownership but does not set a listener. Treat a button action's successful Future, the event increment, and a reconciliation query as separate stages. Do not infer final conversation state from the user's action alone.
Was this page helpful?