attach method

void attach(
  1. PipelineOwner owner,
  2. GameRenderBox gameRenderBox
)

Marks game as attached to any Flutter widget tree.

Should not be called manually.

Implementation

void attach(PipelineOwner owner, GameRenderBox gameRenderBox) {
  if (isAttached) {
    throw UnsupportedError(
      '''
    Game attachment error:
    A game instance can only be attached to one widget at a time.
    ''',
    );
  }
  _gameRenderBox = gameRenderBox;
  if (!_isInternalRefresh) {
    onAttach();
  }
  _isInternalRefresh = false;
}