loadMessagesFromTime method

Future<List<ChatMessage>> loadMessagesFromTime(
  1. {required int startTime,
  2. required int endTime,
  3. int count = 20}

Loads messages from the local database according the following parameters: start timestamp, end timestamp, count.

Note Pay attention to the memory usage when the maxCount is large.

Param startTime The starting Unix timestamp for search.

Param endTime The ending Unix timestamp for search.

Param count The maximum number of message to retrieve.

Returns The list of searched messages.

Throws A description of the exception. See ChatError.


Future<List<ChatMessage>> loadMessagesFromTime({
  required int startTime,
  required int endTime,
  int count = 20,
}) async {
  Map req = this._toJson();
  req["startTime"] = startTime;
  req['endTime'] = endTime;
  req['count'] = count;

  Map<String, dynamic> result = await _emConversationChannel.invokeMethod(
      ChatMethodKeys.loadMsgWithTime, req);

  try {
    List<ChatMessage> msgList = [];
    result[ChatMethodKeys.loadMsgWithTime]?.forEach((element) {
    return msgList;
  } on ChatError catch (e) {
    throw e;