InfiniteListView constructor

const InfiniteListView({
  1. Key? key,
  2. Axis scrollDirection = Axis.vertical,
  3. bool reverse = false,
  4. ScrollController? controller,
  5. bool? primary,
  6. ScrollPhysics? physics,
  7. EdgeInsetsGeometry? padding,
  8. double? cacheExtent,
  9. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  10. ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
  11. String? restorationId,
  12. Clip clipBehavior = Clip.hardEdge,
  13. double? itemExtent,
  14. Widget? prototypeItem,
  15. bool addAutomaticKeepAlives = true,
  16. bool addRepaintBoundaries = true,
  17. bool addSemanticIndexes = true,
  18. required PaginationDelegate delegate,
  19. bool shrinkWrap = false,
})

The InfiniteListView widget in Flutter is a specialized version of the ListView.builder widget that is designed for handling large datasets efficiently. It uses a pagination approach to load and display data in pages as the user scrolls down the list. This helps to improve performance and reduce memory usage, especially when dealing with large datasets that cannot be fully loaded into memory at once.

The InfiniteListView widget takes a PaginationDelegate as its main parameter, which defines the behavior of the list, including the item count, item builder, loading indicator builder, error indicator builder, no more items indicator builder, loading state, error state, and more.

Overall, the InfiniteListView widget is a powerful and efficient solution for building paginated lists in Flutter applications, especially when dealing with large datasets.

Implementation

const InfiniteListView({
  super.key,
  super.scrollDirection,
  super.reverse,
  super.controller,
  super.primary,
  super.physics,
  super.padding,
  super.cacheExtent,
  super.dragStartBehavior,
  super.keyboardDismissBehavior,
  super.restorationId,
  super.clipBehavior,
  this.itemExtent,
  this.prototypeItem,
  this.addAutomaticKeepAlives = true,
  this.addRepaintBoundaries = true,
  this.addSemanticIndexes = true,
  required this.delegate,
  super.shrinkWrap,
})  : assert(
        itemExtent == null || prototypeItem == null,
        'You can only pass itemExtent or prototypeItem, not both',
      ),
      _enableShrinkWrapForFirstPageIndicators = shrinkWrap,
      _separatorBuilder = null;