getConversation static method

Future<Conversation?> getConversation(
  1. int? conversationType,
  2. String? targetId
)

获取特定会话的详细信息

conversationType 会话类型,参见枚举 RCConversationType

targetId 会话 id

return 返回结果为会话的详细数据,如果不存在该会话,那么会返回 null

Implementation

static Future<Conversation?> getConversation(int? conversationType, String? targetId) async {
  if (conversationType == null || targetId == null) {
    developer.log("getConversation error, conversationType or targetId is null", name: "RongIMClient");
    return null;
  }
  Map param = {"conversationType": conversationType, "targetId": targetId};
  String? conStr = await _channel.invokeMethod(RCMethodKey.GetConversation, param);
  Conversation? con = MessageFactory.instance!.string2Conversation(conStr);
  return con;
}