setLeaf method
Creates a copy of this DeepNavigationNode that has newLeaf
set as the child of the current leaf.
Implementation
DeepNavigationNode<T> setLeaf(DeepNavigationNode<T> newLeaf) {
if (child == null) {
return setChild(newLeaf);
}
return createCopy(newChild: child!.setLeaf(newLeaf));
}