TreeDiff constructor

TreeDiff({
  1. required ITreeNode oldTree,
  2. required ITreeNode newTree,
})

Implementation

factory TreeDiff({required ITreeNode oldTree, required ITreeNode newTree}) {
  if (oldTree is TreeNode && newTree is TreeNode)
    return forTree(oldTree: oldTree, newTree: newTree);

  if (oldTree is IndexedTreeNode && newTree is IndexedTreeNode)
    return forIndexedTree(oldTree: oldTree, newTree: newTree);

  return TreeDiff._(oldTree: oldTree, newTree: newTree);
}