update method

  1. @override
void update(
  1. double dt
)

This method is called periodically by the game engine to request that your component updates itself.

The time dt in seconds (with microseconds precision provided by Flutter) since the last update cycle. This time can vary according to hardware capacity, so make sure to update your state considering this. All components in the tree are always updated by the same amount. The time each one takes to update adds up to the next update cycle.

Implementation

@override
void update(double dt) {
  super.update(dt);
  _intervalUpdateOder.update(dt);
  // Increment frame counter so per-frame caches are invalidated on the
  // next frame. This keeps cache valid for the entire frame and avoids
  // repeated recomputation when multiple queries happen in the same frame.
  _frameCounter = _frameCounter + 1;
  final containsChildren = camera.world?.children.isNotEmpty == true;
  if (!_gameMounted && containsChildren) {
    _gameMounted = true;
    Future.delayed(Duration.zero, _notifyGameMounted);
  }
}