gameRef property
BonfireGameInterface
get
gameRef
Implementation
BonfireGameInterface get gameRef {
if (_gameRef == null) {
var c = parent;
while (c != null) {
if (c is BonfireHasGameRef) {
_gameRef = c.gameRef;
return _gameRef!;
} else if (c is BonfireGameInterface) {
_gameRef = c as BonfireGameInterface;
return _gameRef!;
} else {
c = c.parent;
}
}
throw StateError(
'Cannot find reference $BonfireGameInterface in the component tree',
);
}
return _gameRef!;
}
set
gameRef
(BonfireGameInterface gameRef)
Implementation
set gameRef(BonfireGameInterface gameRef) {
_gameRef = gameRef;
this
.children
.whereType<BonfireHasGameRef>()
.forEach((e) => e.gameRef = gameRef);
}