deleteLocalAndServerMessagesByTime method
~english
Removes local and server messages from the conversation by timestamp.
Param beforeMs
The message ids.
Throws A description of the exception. See EMError. ~end
~chinese
通过消息时间戳从本地和服务器删除消息。
Param beforeMs
UNIX 时间戳,单位为毫秒。若消息的 UNIX 时间戳小于设置的值,则会被删除。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError。
~end
Implementation
Future<void> deleteLocalAndServerMessagesByTime(
{required int beforeMs}) async {
Map req = _toJson();
req.putIfNotNull("beforeTs", beforeMs);
Map result = await _emConversationChannel.invokeMethod(
ChatMethodKeys.conversationDeleteServerMessageWithTime, req);
try {
EMError.hasErrorFromResult(result);
return result[ChatMethodKeys.conversationGetLocalMessageCount];
} catch (e) {
rethrow;
}
}