addPart method
Adds the given childPart or a generated empty part at the end.
Implementation
BodyPart addPart([BodyPart? childPart]) {
childPart ??= BodyPart();
parts ??= <BodyPart>[];
parts?.add(childPart);
childPart._parent = this;
return childPart;
}