loadSprite method

Future<Sprite> loadSprite(
  1. String path, {
  2. Vector2? srcSize,
  3. Vector2? srcPosition,
})
inherited

Utility method to load and cache the image for a sprite based on its options.

The path is the full path of the asset, as declared in the pubspec.yaml, for example assets/images/player.png.

Implementation

Future<Sprite> loadSprite(
  String path, {
  Vector2? srcSize,
  Vector2? srcPosition,
}) {
  return Sprite.load(
    path,
    srcPosition: srcPosition,
    srcSize: srcSize,
    images: images,
  );
}