INNER CODE UNIT · Dart
maxIndex
EdsonBueno/infinite_scroll_pagination · lib/src/base/paged_layout_builder.dart:254
final maxIndex = max(0, itemList.length - 1);
final triggerIndex = max(0, maxIndex - _invisibleItemsThreshold);
// It is important to check whether we are past the trigger, not just at it.
// This is because otherwise, large tresholds will place the trigger behind the user,
// Leading to the refresh never being triggered.
// This behaviour is okay because we make sure not to excessively request pages.
final hasPassedTrigger = index >= triggerIndex;
if (hasNextPage && hasPassedTrigger) {
_hasRequestedNextPage = true;
_fetchNextPage();
}
}
final item = itemList[index];
return _builderDelegate.itemBuilder(context, item, index);
}