KeyedSubtreeModifier.wrap constructor

KeyedSubtreeModifier.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 KeyedSubtreeModifier.wrap(Widget child, int childIndex) {
  final Key key = child.key != null ? ValueKey<Key>(child.key!) : ValueKey<int>(childIndex);
  return KeyedSubtreeModifier(key: key, child: child);
}