Browse SDKs · Flutter
Platform
SDKsFlutterIncludes Enterprise features

Conversations overview

Understand ConversationInfo, conversationID, conversation settings, and event responsibilities in the OpenIM Flutter SDK.

Copy

In OpenIM, a Conversation encapsulates the chat state maintained locally by the client for a single-chat or group-chat channel. It is represented by a ConversationInfo record scoped to the currently signed-in user. It holds list-level state including unread counts, latest messages, pin status, drafts, notification reception options, and custom extensions. A conversation record is distinguished from chat destinations: conversationID identifies the conversation state of the active account, single-chat targets use the counterparty's userID, and group-chat targets use groupID.

Both single-chat and group-chat channels project their list status onto conversation records; group metadata, membership relations, and permissions remain governed by Group APIs. A group chat view uses groupID to access group capabilities while using conversationID to manage conversation settings, unread counts, drafts, and message history.

Conversation identifiers

Single-chat conversations use the counterparty user ID as sourceID with conversationType set to ConversationType.single; group-chat conversations use groupID as sourceID with conversationType set to ConversationType.superGroup. Call Get conversation ID to obtain a deterministic conversationID before invoking conversation settings, read receipts, hiding, or message deletion.

IdentifierPurpose
conversationIDLocal conversation record ID of the active account. Used for settings, history queries, and unread states.
userIDCounterparty user ID in a single-chat conversation.
groupIDTarget group ID in a group-chat conversation; also used for Group APIs.
sourceIDTarget ID passed when querying by session type: userID for single chat, groupID for group chat.

ConversationInfo

Key fields in ConversationInfo:

FieldDescription
conversationIDConversation ID.
conversationTypeConversation type.
userIDCounterparty user ID in single chats.
groupIDTarget group ID in group chats.
showNameDisplay name of the conversation.
faceURLDisplay avatar URL of the conversation.
unreadCountUnread message count of this conversation.
latestMsgThe most recent message payload.
latestMsgSendTimeTimestamp when the latest message was sent.
recvMsgOptMessage reception option for this conversation.
groupAtTypeMention notification state in group chats.
draftTextLocal draft message content.
draftTextTimeTimestamp when the draft was updated.
isPinnedWhether the conversation is pinned to the top.
isPrivateChat EnterpriseWhether private chat mode is enabled.
isMsgDestruct EnterpriseWhether message auto-destruction is enabled.
burnDuration EnterpriseSelf-destruct countdown duration in seconds.
msgDestructTime EnterpriseMessage destruction time configuration.
exCustom business extension string.

Queries and settings

Conversation lifecycle

Conversation groups

Conversation groups overview covers organizing conversations into custom folders or tags. Group entries use conversationID, while the group itself uses conversationGroupID. It only reorganizes conversations for the current account; it does not create chat groups or alter groupID membership or permissions.

The Flutter SDK provides this capability through ConversationGroupManager. Queries return folder hierarchies, group events update by conversationGroupID, and member events update by combining conversationGroupID with conversationID. The overview page provides data models, complete listener setup, and links to individual APIs.

State synchronization

Query methods load the initial snapshot required by the view, while events merge subsequent incremental changes:

Register listeners centrally within dedicated capability modules rather than fragmenting listeners across Widget trees. Future completion, subsequent event arrivals, and query recalibrations represent distinct lifecycle phases; handle each explicitly rather than assuming immediate state transitions based on local user interactions.