TwoDimensionalIndexedWidgetBuilder typedef

TwoDimensionalIndexedWidgetBuilder = Widget? Function(BuildContext context, ChildVicinity vicinity)

Signature for a function that creates a widget for a given ChildVicinity, e.g., in a TwoDimensionalScrollView, but may return null.

Used by TwoDimensionalChildBuilderDelegate.builder and other APIs that use lazily-generated widgets where the child count may not be known ahead of time.

Unlike most builders, this callback can return null, indicating the ChildVicinity.xIndex or ChildVicinity.yIndex is out of range. Whether and when this is valid depends on the semantics of the builder. For example, TwoDimensionalChildBuilderDelegate.builder returns null when one or both of the indices is out of range, where the range is defined by the TwoDimensionalChildBuilderDelegate.maxXIndex or TwoDimensionalChildBuilderDelegate.maxYIndex; so in that case the vicinity values may determine whether returning null is valid or not.

See also:

Implementation

typedef TwoDimensionalIndexedWidgetBuilder = Widget? Function(BuildContext context, ChildVicinity vicinity);