forwardCopy static method

ChildLayoutDryDelegate? forwardCopy(
  1. ChildLayout? firstChild,
  2. LayoutHandle<Layout> layoutHandle
)

Creates a forward-linked chain of dry layout delegates.

Starting from firstChild, creates a linked list of delegates that can perform dry layout operations. Returns the first delegate in the chain, or null if firstChild is null.

Implementation

static ChildLayoutDryDelegate? forwardCopy(
  ChildLayout? firstChild,
  LayoutHandle<Layout> layoutHandle,
) {
  ChildLayoutDryDelegate? first;
  ChildLayoutDryDelegate? last;
  ChildLayout? child = firstChild;
  while (child != null) {
    final delegate = ChildLayoutDryDelegate(child, layoutHandle.setupCache());
    if (first == null) {
      first = delegate;
      last = delegate;
    } else {
      last!.nextSibling = delegate;
      delegate.previousSibling = last;
      last = delegate;
    }
    child = child.nextSibling;
  }
  return first;
}