childBefore method

RenderBox? childBefore(
  1. RenderBox child
)

The previous child before the given child in the child list according to the traversal order of the mainAxis.

The mainAxis correlates with the ChildVicinity of each child to paint the children in a row or column major order.

By default, the mainAxis is Axis.vertical, which would result in a row major paint order, visiting children in the horizontal indices before advancing to the next vertical index.

This method is useful when overriding paint in order to paint children in the correct order.

Implementation

RenderBox? childBefore(RenderBox child) {
  assert(child.parent == this);
  return parentDataOf(child)._previousSibling;
}