lastReceivedMessage method

Future<EMMessage?> lastReceivedMessage()

获取最近收到的一条消息。

Return 消息体实例。

Implementation

Future<EMMessage?> lastReceivedMessage() async {
  Map req = this._toJson();
  Map result = await _emConversationChannel.invokeMethod(
      ChatMethodKeys.getLatestMessageFromOthers, req);
  try {
    EMError.hasErrorFromResult(result);
    if (result.containsKey(ChatMethodKeys.getLatestMessageFromOthers)) {
      return EMMessage.fromJson(
          result[ChatMethodKeys.getLatestMessageFromOthers]);
    } else {
      return null;
    }
  } on EMError catch (e) {
    throw e;
  }
}