setChildOrder method
Sets the complete back-to-front paint and hit-test order atomically. Every existing ID, including culled children, must appear exactly once. Throws ArgumentError for missing, duplicate, unknown, or excess IDs, leaving order unchanged without notifying. Changed orders notify once; unchanged orders (including an empty stack) do not notify.
Implementation
void setChildOrder(List<CanvasChildId> ids) {
if (ids.length != _children.length ||
ids.toSet().length != ids.length ||
ids.any((id) => !_children.containsKey(id))) {
throw ArgumentError.value(ids, 'ids', 'Expected every existing ID once');
}
if (listEquals(childOrder, ids)) return;
for (var index = 0; index < ids.length; index++) {
_children[ids[index]]!.paintOrder = index;
}
_nextPaintOrder = ids.length;
markDirty();
}