load static method
Takes the full path of an image, a srcPosition and srcSize and loads
the sprite.
The src is the full path of the asset, as declared in the
pubspec.yaml, for example assets/images/player.png.
When the images is omitted, the global Flame.images is used.
Implementation
static Future<Sprite> load(
String src, {
Vector2? srcPosition,
Vector2? srcSize,
Images? images,
String? package,
}) async {
final imagesCache = images ?? Flame.images;
final image = await imagesCache.load(src, package: package);
return Sprite(image, srcPosition: srcPosition, srcSize: srcSize);
}