lastReceivedMessage method Null safety
Gets the latest message from the conversation.
Return The message instance.
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;
}
}