setChildIndex method

void setChildIndex(
  1. GDisplayObject child,
  2. int index
)

Sets the index of a child in the list of children of this container.

Implementation

void setChildIndex(GDisplayObject child, int index) {
  final old = getChildIndex(child);
  if (old == index) return;
  if (old == -1) {
    throw ArgumentError.value(child, null, 'Not a child of this container');
  }
  children.removeAt(old);
  children.insert(index.clamp(0, numChildren), child);
  requiresRedraw();
}