getChildrenAsList method

List<ChildType> getChildrenAsList ()

Returns a list containing the children of this render object.

This function is useful when you need random-access to the children of this render object. If you're accessing the children in order, consider walking the child list directly.

Implementation

List<ChildType> getChildrenAsList() {
  final List<ChildType> result = <ChildType>[];
  RenderBox child = firstChild;
  while (child != null) {
    final ParentDataType childParentData = child.parentData;
    result.add(child);
    child = childParentData.nextSibling;
  }
  return result;
}