loadNextRecentChat method

void loadNextRecentChat()

Implementation

void loadNextRecentChat() {
  recentChatPage++;
  isRecentHistoryLoading(true);
  debugPrint("calling page no $recentChatPage");
  callback(FlyResponse response) {
    if (response.isSuccess && response.hasData) {
      debugPrint("getRecentChatListHistory next data ${response.data}");
      var data = recentChatFromJson(response
          .data); //await compute(recentChatFromJson, value.toString());
      LogMessage.d("getRecentChatListHistory", data.toJson());
      recentChats.addAll(data.data!);
      recentChats.refresh();
      isRecentHistoryLoading(false);
      getArchivedChatsList();
      chatLimit += chatLimit;
    } else {
      debugPrint("recent chat issue===> ${response.exception}");
      isRecentHistoryLoading(false);
    }
  }

  Constants.enableTopic
      ? Mirrorfly.getRecentChatListHistoryByTopic(
          firstSet: recentChatPage == 1,
          limit: chatLimit,
          topicId: topicId.value,
          flyCallback: callback)
      : Mirrorfly.getRecentChatListHistory(
          firstSet: recentChatPage == 1,
          limit: chatLimit,
          flyCallback: callback);
}