getConversation method

Future<EMConversation?> getConversation(
  1. String conversationId, [
  2. EMConversationType type = EMConversationType.Chat,
  3. bool createIfNeed = true
])

通过会话id, 会话类型type获取会话.

Implementation

Future<EMConversation?> getConversation(
  String conversationId, [
  EMConversationType type = EMConversationType.Chat,
  bool createIfNeed = true,
]) async {
  Map req = {
    "con_id": conversationId,
    "type": EMConversation.typeToInt(type),
    "createIfNeed": createIfNeed
  };
  Map result = await _channel.invokeMethod(EMSDKMethod.getConversation, req);
  EMError.hasErrorFromResult(result);
  EMConversation? ret;
  if (result[EMSDKMethod.getConversation] != null) {
    ret = EMConversation.fromJson(result[EMSDKMethod.getConversation]);
  }
  return ret;
}