InfiniteListView constructor
- Key? key,
- Axis scrollDirection = Axis.vertical,
- bool reverse = false,
- ScrollController? controller,
- bool? primary,
- ScrollPhysics? physics,
- EdgeInsetsGeometry? padding,
- double? cacheExtent,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
- String? restorationId,
- Clip clipBehavior = Clip.hardEdge,
- double? itemExtent,
- Widget? prototypeItem,
- bool addAutomaticKeepAlives = true,
- bool addRepaintBoundaries = true,
- bool addSemanticIndexes = true,
- required PaginationDelegate delegate,
- 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;