centerInStage method

void centerInStage()

Centers the object in the middle of the Stage if it's added to the stage.

Implementation

void centerInStage() {
  if (!inStage) {
    return;
  }
  setPosition(stage!.stageWidth / 2, stage!.stageHeight / 2);
}