GetSliverList.builder constructor

const GetSliverList.builder({
  1. required GetItemBuilder itemBuilder,
  2. List? items,
  3. IndexedWidgetBuilder? dividerBuilder,
  4. WidgetBuilder? edgeDividerBuilder,
  5. WidgetBuilder? headerBuilder,
  6. WidgetBuilder? footerBuilder,
  7. GetSectionBuilder? sectionBuilder,
  8. GetSection? section,
  9. int? itemCount,
  10. DividerStyle? divider,
  11. DividerStyle edgeDivider = DividerStyle.full,
  12. EdgeInsetsGeometry? padding,
  13. bool addAutomaticKeepAlives = true,
  14. bool addRepaintBoundaries = true,
  15. bool addSemanticIndexes = true,
  16. Axis scrollDirection = Axis.vertical,
  17. Key? key,
})

Creates a fixed-length scrollable linear array of list "items" separated by list item "separators".

This constructor is appropriate for list views with a large number of item and separator children because the builders are only called for the children that are actually visible.

The itemBuilder callback will be called with indices greater than or equal to zero and less than itemCount.

Separators only appear between list items: separator 0 appears after item 0 and the last separator appears before the last item.

The separatorBuilder callback will be called with indices greater than or equal to zero and less than itemCount.

The itemBuilder and separatorBuilder callbacks should always return a non-null widget, and actually create widget instances when called. Avoid using a builder that returns a previously-constructed widget; if the list view's children are created in advance.

The addAutomaticKeepAlives argument corresponds to the SliverChildBuilderDelegate.addAutomaticKeepAlives property. The addRepaintBoundaries argument corresponds to the SliverChildBuilderDelegate.addRepaintBoundaries property. The addSemanticIndexes argument corresponds to the SliverChildBuilderDelegate.addSemanticIndexes property. None may be null.

Implementation

const GetSliverList.builder({
  required GetItemBuilder this.itemBuilder,
  this.items,
  this.dividerBuilder,
  this.edgeDividerBuilder,
  this.headerBuilder,
  this.footerBuilder,
  this.sectionBuilder,
  this.section,
  int? itemCount,
  this.divider,
  this.edgeDivider = DividerStyle.full,
  this.padding,
  this.addAutomaticKeepAlives = true,
  this.addRepaintBoundaries = true,
  this.addSemanticIndexes = true,
  this.scrollDirection = Axis.vertical,
  Key? key,
})  : assert(itemBuilder != null),
      itemCount = itemCount ?? items?.length ?? 0,
      children = null,
      itemExtent = null,
      prototypeItem = null,
      super(key: key);