getLocalMessageCount method

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

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 ChatError.

Implementation

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