load static method

Future<SpriteBatch> load(
  1. String path, {
  2. RSTransform? defaultTransform,
  3. Images? images,
  4. Color? defaultColor,
  5. BlendMode? defaultBlendMode,
  6. bool useAtlas = true,
})

Takes a path of an image, and optional arguments for the SpriteBatch.

When the images is omitted, the global Flame.images is used.

Implementation

static Future<SpriteBatch> load(
  String path, {
  RSTransform? defaultTransform,
  Images? images,
  Color? defaultColor,
  BlendMode? defaultBlendMode,
  bool useAtlas = true,
}) async {
  final imagesCache = images ?? Flame.images;
  return SpriteBatch(
    await imagesCache.load(path),
    defaultTransform: defaultTransform ?? RSTransform(1, 0, 0, 0),
    defaultColor: defaultColor,
    defaultBlendMode: defaultBlendMode,
    useAtlas: useAtlas,
    imageCache: imagesCache,
    imageKey: path,
  );
}