backwardCopy static method
Creates a backward-linked chain of dry layout delegates.
Starting from lastChild
, creates a linked list of delegates
in reverse order. Returns the last delegate in the chain,
or null if lastChild
is null.
Implementation
static ChildLayoutDryDelegate? backwardCopy(
ChildLayout? lastChild,
LayoutHandle<Layout> layoutHandle,
) {
ChildLayoutDryDelegate? first;
ChildLayoutDryDelegate? last;
ChildLayout? child = lastChild;
while (child != null) {
final delegate = ChildLayoutDryDelegate(child, layoutHandle.setupCache());
if (last == null) {
last = delegate;
first = delegate;
} else {
first!.previousSibling = delegate;
delegate.nextSibling = first;
first = delegate;
}
child = child.previousSibling;
}
return last;
}