getLocalMessageCount method

Future<int> getLocalMessageCount({
  1. required int startMs,
  2. required int endMs,
})

~english Gets the local message count. The count of messages in the local database within the specified time range.

Param startMs The start time of the time range.

Param endMs The end time of the time range.

Returns The count of messages in the local database within the specified time range.

Throws A description of the exception. See EMError.

~end

~chinese

获取本地消息数量。

获取指定时间范围内本地数据库中的消息数量。

Param startMs 时间范围的开始时间。

Param endMs 时间范围的结束时间。

Return 指定时间范围内本地数据库中的消息数量。

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError

~end

Implementation

Future<int> getLocalMessageCount({
  required int startMs,
  required int endMs,
}) async {
  Map req = _toJson();
  req.putIfNotNull("startTs", startMs);
  req.putIfNotNull("endTs", endMs);
  Map result = await _emConversationChannel.invokeMethod(
      ChatMethodKeys.conversationGetLocalMessageCount, req);
  try {
    EMError.hasErrorFromResult(result);
    return result[ChatMethodKeys.conversationGetLocalMessageCount];
  } catch (e) {
    rethrow;
  }
}