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.

Source

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