updateChild method
Implementation
void updateChild(NopDependencies newChild) {
assert(child == null || child!.parent == this);
newChild.child = child?.child;
newChild.child?.parent = newChild;
child?._remove();
newChild.parent = this;
child = newChild;
}