lastReceivedMessage method
~english Gets the latest message from the conversation.
Return The message instance. ~end
~chinese 获取最近收到的一条消息。
Return 消息体实例。 ~end
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;
}
}