getThreadConversation method

Future<EMConversation?> getThreadConversation(
  1. String threadId
)

~english Gets the thread conversation by thread ID.

Param threadId The thread ID.

Return The conversation object.

Throws A description of the exception. See EMError. ~end

~chinese 根据thread ID 获取 thread 会话。

Param threadId Thread ID.

Return 会话对象.

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError。 ~end

Implementation

Future<EMConversation?> getThreadConversation(String threadId) async {
  Map result = await ChatChannel.invokeMethod(
    ChatMethodKeys.getThreadConversation,
    {"convId": threadId},
  );

  try {
    EMConversation? ret;
    EMError.hasErrorFromResult(result);
    if (result[ChatMethodKeys.getThreadConversation] != null) {
      ret = EMConversation.fromJson(
          result[ChatMethodKeys.getThreadConversation]);
    }
    return ret;
  } on EMError catch (e) {
    throw e;
  }
}