findRootGame method

FlameGame<World>? findRootGame()

Fetches the root FlameGame ancestor to the component.

Implementation

FlameGame? findRootGame() {
  var game = findGame();
  while (game?.parent != null) {
    game = game!.parent!.findGame();
  }
  return game;
}