RepaintBoundary.wrap constructor

RepaintBoundary.wrap(Widget child, 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);
}