CupertinoListView.builder constructor Null safety

  1. {required int sectionCount,
  2. required SectionBuilder sectionBuilder,
  3. required SectionChildBuilder childBuilder,
  4. required SectionItemCount itemInSectionCount,
  5. ChildSeparatorBuilder? separatorBuilder,
  6. ScrollController? controller,
  7. double? cacheExtent,
  8. Clip clipBehavior = Clip.hardEdge,
  9. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  10. ScrollPhysics? physics,
  11. String? restorationId,
  12. EdgeInsets? padding,
  13. ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual}

Creates a scrollable, linear array of widgets that are created on demand, defined by sections. A section is a widget describing a finite group of children.

To define these section, the CupertinoListView first retrieve the number of sections using sectionCount input parameter. Then the widget will call itemInSectionCount to define the number of children each section has.

Added to that, the CupertinoListView display the current section as a floating widget, that will be pushed away by the next section title, as iOS UITableView does.

This constructor is appropriate for list views with a large (or infinite) number of children because the builder is called only for those children that are actually visible.


factory CupertinoListView.builder({
  required int sectionCount,
  required SectionBuilder sectionBuilder,
  required SectionChildBuilder childBuilder,
  required SectionItemCount itemInSectionCount,
  ChildSeparatorBuilder? separatorBuilder,
  ScrollController? controller,
  double? cacheExtent,
  Clip clipBehavior = Clip.hardEdge,
  DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  ScrollPhysics? physics,
  String? restorationId,
  EdgeInsets? padding,
  ScrollViewKeyboardDismissBehavior keyboardDismissBehavior =
}) {
  assert(sectionCount > 0);

  final delegate = CupertinoListBuilderDelegate(
    sectionCount: sectionCount,
    childBuilder: childBuilder,
    sectionBuilder: sectionBuilder,
    itemInSectionCount: itemInSectionCount,
    separatorBuilder: separatorBuilder,
  return CupertinoListView._(
    delegate: delegate,
    controller: controller,
    padding: padding,
    cacheExtent: cacheExtent,
    clipBehavior: clipBehavior,
    dragStartBehavior: dragStartBehavior,
    keyboardDismissBehavior: keyboardDismissBehavior,
    physics: physics,
    restorationId: restorationId,