chatThread method Null safety

Future<EMChatThread?> chatThread()

Get an overview of the thread in the message (currently only supported by group messages)

Return overview of the thread

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

Implementation

Future<EMChatThread?> chatThread() async {
  Map req = {"msg": msgId};
  Map result =
      await _emMessageChannel.invokeMethod(ChatMethodKeys.getChatThread, req);
  try {
    EMError.hasErrorFromResult(result);
    if (result.containsKey(ChatMethodKeys.getChatThread)) {
      return result.getValueWithKey<EMChatThread>(
          ChatMethodKeys.getChatThread,
          callback: (obj) => EMChatThread.fromJson(obj));
    } else {
      return null;
    }
  } on EMError catch (e) {
    throw e;
  }
}