loadSprite method
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,
);
}