Browse SDKs · Flutter
SDKsFlutter

Resolve a conversation ID

Resolve a conversation ID from a chat target with the OpenIM Flutter SDK.

Copy

When only the conversation ID is needed, call getConversationIDBySessionType() instead of assembling an ID in application code.

final conversationID = await OpenIM.iMManager.conversationManager
    .getConversationIDBySessionType(
  sourceID: targetUserID,
  sessionType: ConversationType.single,
);

For a one-to-one chat, sourceID is the other user's ID. For a group chat, it is the group ID and sessionType is ConversationType.superGroup. A successful Future returns the conversation ID, not a complete ConversationInfo, and does not trigger a conversation callback.