leadingItem property

int get leadingItem

The current leading item index in the CarouselView.

A callback invoked when the leading item changes.

The leading item is the first visible item in the carousel view.

The callback fires only when the leading item is completely out of view, whether due to user interaction or programmatic scrolling. If the leading item remains partially visible, the leading index will not change and the callback will not be invoked.

Implementation

int get leadingItem {
  assert(
    positions.isNotEmpty,
    'CarouselController.leadingItem cannot be accessed before a CarouselView is built with it.',
  );
  assert(
    positions.length == 1,
    'CarouselController.leadingItem cannot be read when multiple CarouselViews '
    'are attached to the same controller.',
  );
  return (position as _CarouselPosition).leadingItem;
}