leadingItem property

int get leadingItem

The current leading item index in the M3ECarouselView.

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.',
  );
  final List<double>? extents = variedItemExtents;
  if (extents != null && position is! _CarouselPosition) {
    return _leadingFromExtents(position.pixels, extents);
  }
  return (position as _CarouselPosition).leadingItem;
}