INNER CODE UNIT · Dart

triggerIndex

EdsonBueno/infinite_scroll_pagination · lib/src/base/paged_layout_builder.dart:255

      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);
  }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…