SDKsFlutter
生成会话 ID
使用 Flutter SDK 按聊天目标计算会话 ID。
只需要会话 ID 时调用 getConversationIDBySessionType(),不要在应用层自行拼接。
final conversationID = await OpenIM.iMManager.conversationManager
.getConversationIDBySessionType(
sourceID: targetUserID,
sessionType: ConversationType.single,
);sourceID 在单聊中是对方用户 ID,在群聊中是群组 ID;群聊使用 ConversationType.superGroup。Future 成功返回会话 ID,不返回完整 ConversationInfo,也不触发会话回调。
这个页面有帮助吗?