GetSliverList constructor

const GetSliverList({
  1. List<Widget> children = const [],
  2. EdgeInsetsGeometry? padding,
  3. double? itemExtent,
  4. Widget? prototypeItem,
  5. bool addAutomaticKeepAlives = true,
  6. bool addRepaintBoundaries = true,
  7. bool addSemanticIndexes = true,
  8. Axis scrollDirection = Axis.vertical,
  9. Key? key,
})

Creates a scrollable, linear array of widgets from an explicit List.

This constructor is appropriate for list views with a small number of children because constructing the List requires doing work for every child that could possibly be displayed in the list view instead of just those children that are actually visible.

Like other widgets in the framework, this widget expects that the children list will not be mutated after it has been passed in here. See the documentation at SliverChildListDelegate.children for more details.

It is usually more efficient to create children on demand using GetListView.builder because it will create the widget children lazily as necessary.

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

Implementation

const GetSliverList({
  List<Widget> this.children = const [],
  this.padding,
  this.itemExtent,
  this.prototypeItem,
  this.addAutomaticKeepAlives = true,
  this.addRepaintBoundaries = true,
  this.addSemanticIndexes = true,
  this.scrollDirection = Axis.vertical,
  Key? key,
})  : assert(children != null),
      assert(
        itemExtent == null || prototypeItem == null,
        'You can only pass itemExtent or prototypeItem, not both.',
      ),
      itemCount = children.length,
      itemBuilder = null,
      items = null,
      dividerBuilder = null,
      edgeDividerBuilder = null,
      headerBuilder = null,
      footerBuilder = null,
      sectionBuilder = null,
      section = null,
      divider = null,
      edgeDivider = DividerStyle.none,
      super(key: key);