getThreadConversation method

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

根据 thread ID 获取 thread 会话。

Param threadId Thread ID.

Return 会话对象.

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

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;
  }
}