fetchChatThread method Null safety

Future<EMChatThread?> fetchChatThread(
  1. {required String chatThreadId}
)

Get Chat Thread details from server.

Param chatThreadId Chat Thread ID.

Return The chat thread object.

Throws A description of the exception. See {@link EMError}.

Implementation

Future<EMChatThread?> fetchChatThread({
  required String chatThreadId,
}) async {
  Map req = {"threadId": chatThreadId};
  Map result = await _channel.invokeMethod(
    ChatMethodKeys.fetchChatThreadDetail,
    req,
  );
  try {
    EMError.hasErrorFromResult(result);
    return EMChatThread.fromJson(
        result[ChatMethodKeys.fetchChatThreadDetail]);
  } on EMError catch (e) {
    throw e;
  }
}