of static method

TreeDiff of(
  1. InspectNode? base,
  2. InspectNode? head
)

Implementation

static TreeDiff of(InspectNode? base, InspectNode? head) {
  var deltas = <TreeDelta>[];
  if (base == null && head == null) return const TreeDiff([]);
  if (base == null) {
    deltas.add(TreeDelta.added(_label(head!), head.type));
  } else if (head == null) {
    deltas.add(TreeDelta.removed(_label(base), base.type));
  } else {
    _walk(base, head, '', deltas, ancestorResized: false);
  }
  return TreeDiff(_causeFirst(deltas));
}