prepend<T extends BuildBit> method

T prepend<T extends BuildBit>(
  1. T bit
)

Prepends bit.

See also: append.

Implementation

T prepend<T extends BuildBit>(T bit) {
  final child = bit.parent == this ? bit : bit.copyWith(parent: this);
  final scopedChildren = _children ??= [];
  scopedChildren.insert(0, child);
  return bit;
}