delete method

void delete()
override

Delete this node

Implementation

void delete() {
  if (parent == null)
    root.clear();
  else
    parent?.remove(this);
}