isPageRequestedFor method Null safety

bool isPageRequestedFor(
  1. int threadIndex
)

Checks if the page for the given thread threadIndex is already requested in a ThreadPreference.latest based result.

Note that the threadIndex is expected to be based on full threadData, meaning 0 is the newest thread and length-1 is the oldest thread.

Implementation

bool isPageRequestedFor(int threadIndex) {
  assert(threadPreference == ThreadPreference.latest,
      'This call is only valid for ThreadPreference.latest');
  final index = (length - threadIndex - 1);
  return index >
      length - (threadSequence.currentPageIndex * threadSequence.pageSize);
}