game property

T game

Reference to the top-level Game instance that owns this component.

This property is accessible in the component's onLoad and later. It may be accessible earlier too, but only if your game uses the SingleGameInstance mixin.

Implementation

T get game => _game ??= _findGameAndCheck();
void game=(T? value)

Allows you to set the game instance explicitly. This may be useful in tests, or if you're planning to move the component to another game instance.

Implementation

set game(T? value) => _game = value;