loadMessage method

Future<EMMessage?> loadMessage(
  1. String messageId
)

根据消息id获取消息,如果消息id不属于当前会话,则无法获取到

Implementation

Future<EMMessage?> loadMessage(String messageId) async {
  Map req = this.toJson();
  req['msg_id'] = messageId;
  Map result = await _emConversationChannel.invokeMethod(
      EMSDKMethod.loadMsgWithId, req);
  EMError.hasErrorFromResult(result);
  if (result[EMSDKMethod.loadMsgWithId] != null) {
    return EMMessage.fromJson(result[EMSDKMethod.loadMsgWithId]);
  } else {
    return null;
  }
}