SliverChildBuilderDelegate constructor Null safety

const SliverChildBuilderDelegate(
  1. NullableIndexedWidgetBuilder builder,
  2. {ChildIndexGetter? findChildIndexCallback,
  3. int? childCount,
  4. bool addAutomaticKeepAlives = true,
  5. bool addRepaintBoundaries = true,
  6. bool addSemanticIndexes = true,
  7. SemanticIndexCallback semanticIndexCallback = _kDefaultSemanticIndexCallback,
  8. int semanticIndexOffset = 0}

Creates a delegate that supplies children for slivers using the given builder callback.

The builder, addAutomaticKeepAlives, addRepaintBoundaries, addSemanticIndexes, and semanticIndexCallback arguments must not be null.

If the order in which builder returns children ever changes, consider providing a findChildIndexCallback. This allows the delegate to find the new index for a child that was previously located at a different index to attach the existing state to the Widget at its new location.


const SliverChildBuilderDelegate(
  this.builder, {
  this.addAutomaticKeepAlives = true,
  this.addRepaintBoundaries = true,
  this.addSemanticIndexes = true,
  this.semanticIndexCallback = _kDefaultSemanticIndexCallback,
  this.semanticIndexOffset = 0,
}) : assert(builder != null),
     assert(addAutomaticKeepAlives != null),
     assert(addRepaintBoundaries != null),
     assert(addSemanticIndexes != null),
     assert(semanticIndexCallback != null);