conversationId static method

String? conversationId(
  1. String targetId,
  2. NIMConversationType type
)

Implementation

static String? conversationId(String targetId, NIMConversationType type) {
  // 检查输入参数有效性
  if (targetId.isEmpty) {
    return null;
  }

  // 获取当前用户账号
  String? account = IMKitClient.account();

  // 检查账号有效性
  if (account == null || account.isEmpty) {
    return null;
  }

  // 生成格式化的会话ID
  return '${account}${CONVERSATION_ID_SPLIT}${type.getValue()}${CONVERSATION_ID_SPLIT}${targetId}';
}