retrieveWidget method Null safety

Widget? retrieveWidget(
  1. int index
)

Asks the underlying delegate for a widget at the given index.

Normally the builder is only called once for each index and the result will be cached. However when the element is rebuilt, the cache will be cleared.

Implementation

Widget? retrieveWidget(int index) {
  return _childWidgets.putIfAbsent(index, () => widget.childDelegate.build(this, index));
}