replaceElement method
Implementation
bool replaceElement(T? child1, List<T>? child2) {
if (child1 == null || child2 == null) return false;
var parent = getNodeParent(child1);
if (parent == null) return false;
return replaceChildElement(parent, child1, child2);
}