replace method
Implementation
void replace(Mobject mob, {int dimToMatch = 0, bool stretch = false}) {
if (hasNoPoints() && submobjects.isEmpty) {
throw 'Attempting to replace a mobject with no points';
}
if (stretch) {
stretchToFitWidth(mob.getWidth());
stretchToFitHeight(mob.getHeight());
} else {
rescaleToFit(
mob.lengthOverDim(dimToMatch),
dimToMatch,
stretch: false,
);
}
shift(mob.getCenter() - getCenter());
}