buildSprite method Null safety

SceneObject buildSprite(
  1. TextureRegion textureRegion,
  2. int priority,
  3. {bool cameraRelative = true,
  4. double rotation = 0.0,
  5. double scale = 1.0,
  6. double opacity = 1.0}
)

Implementation

SceneObject buildSprite(
  TextureRegion textureRegion,
  int priority, {
  bool cameraRelative = true,
  double rotation = 0.0,
  double scale = 1.0,
  double opacity = 1.0,
}) {
  var renderComponent = RenderComponent(priority, cameraRelative: cameraRelative);
  var spriteComponent = SpriteComponent(textureRegion,
      render: renderComponent, rotation: rotation, scale: scale, opacity: opacity);
  return SceneObject()
    ..add(renderComponent)
    ..add(spriteComponent);
}