isItemRendered method

bool isItemRendered(
  1. int index
)

Checks if the item at the given index is currently rendered within the widget tree.

An item is considered rendered if it is either within the visible viewport of the list or grid, or within the cacheExtent area (pre-rendered items just outside of the visible viewport).

This method does not guarantee that the item is visible on screen but only that it is part of the widget tree.

index: The position of the item in the list or grid. Must be a valid index for the current data.

Returns:

  • true: If the item is rendered (either visible or within the cache extent area).
  • false: If the item is not currently rendered (i.e., outside of the widget tree).

Example:

bool isRendered = isItemRendered(5);
if (isRendered) {
  // The item is rendered in the widget tree, perform further actions
}

Implementation

bool isItemRendered(int index) => _controller.isItemRendered(index);