addPart method

BodyPart addPart([
  1. BodyPart? childPart
])

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;
}