RepaintBoundary.wrap constructor

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

Wraps the given child in a RepaintBoundary.

The key for the RepaintBoundary is derived either from the child's key (if the child has a non-null key) or from the given childIndex.

Implementation

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