StatusChangeTileBuilder constructor Null safety

StatusChangeTileBuilder(
  1. {required int itemCount,
  2. IndexedWidgetBuilder? contentsBuilder,
  3. IndexedWidgetBuilder? oppositeContentsBuilder,
  4. IndexedWidgetBuilder? indicatorBuilder,
  5. IndexedWidgetBuilder? startConnectorBuilder,
  6. IndexedWidgetBuilder? endConnectorBuilder,
  7. dynamic itemExtentBuilder(
    1. int index
    )?,
  8. dynamic nodePositionBuilder(
    1. int index
    )?,
  9. dynamic nodeItemOverlapBuilder(
    1. int index
    )?}
)

Implementation

factory StatusChangeTileBuilder({
  required int itemCount,
  IndexedWidgetBuilder? contentsBuilder,
  IndexedWidgetBuilder? oppositeContentsBuilder,
  IndexedWidgetBuilder? indicatorBuilder,
  IndexedWidgetBuilder? startConnectorBuilder,
  IndexedWidgetBuilder? endConnectorBuilder,
  Function(int index)? itemExtentBuilder,
  Function(int index)? nodePositionBuilder,
  Function(int index)? nodeItemOverlapBuilder,
}) {
  final effectiveContentsBuilder = _createAlignedContentsBuilder(
    contentsBuilder: contentsBuilder!,
    oppositeContentsBuilder: oppositeContentsBuilder,
  );
  final effectiveOppositeContentsBuilder = _createAlignedContentsBuilder(
    contentsBuilder: oppositeContentsBuilder!,
    oppositeContentsBuilder: contentsBuilder,
  );

  return StatusChangeTileBuilder._(
    (context, index) {
      final tile = StatusChangeTile(
        mainAxisExtent: itemExtentBuilder?.call(index),
        node: TimelineNode(
          startConnector: startConnectorBuilder?.call(context, index),
          endConnector: endConnectorBuilder?.call(context, index),
          position: nodePositionBuilder?.call(index),
          indicator: indicatorBuilder!.call(context, index),
        ),
        contents: effectiveContentsBuilder(context, index),
        oppositeContents: effectiveOppositeContentsBuilder(context, index),
      );

      return tile;
    },
    itemCount: itemCount,
  );
}