childrenInPaintOrder property Null safety

Iterable<RenderSliver> childrenInPaintOrder
override

Provides an iterable that walks the children of the viewport, in the order that they should be painted.

This should be the reverse order of childrenInHitTestOrder.

Implementation

@override
Iterable<RenderSliver> get childrenInPaintOrder {
  final List<RenderSliver> children = <RenderSliver>[];
  if (firstChild == null) {
    return children;
  }
  RenderSliver? child = firstChild;
  while (child != center) {
    children.add(child!);
    child = childAfter(child);
  }
  child = lastChild;
  while (true) {
    children.add(child!);
    if (child == center) {
      return children;
    }
    child = childBefore(child);
  }
}