KeyedSubtree.wrap constructor

KeyedSubtree.wrap(
  1. Widget child,
  2. int childIndex
)

Creates a KeyedSubtree for child with a key that's based on the child's existing key or childIndex.

Implementation

factory KeyedSubtree.wrap(Widget child, int childIndex) {
  final Key key = child.key != null ? ValueKey<Key>(child.key!) : ValueKey<int>(childIndex);
  return KeyedSubtree(key: key, child: child);
}