load static method

Future<SpriteBatch> load(
  1. String path, {
  2. Color defaultColor = const Color(0x00000000),
  3. BlendMode defaultBlendMode = BlendMode.srcOver,
  4. RSTransform? defaultTransform,
  5. Images? images,
})

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, {
  Color defaultColor = const Color(0x00000000),
  BlendMode defaultBlendMode = BlendMode.srcOver,
  RSTransform? defaultTransform,
  Images? images,
}) async {
  final _images = images ?? Flame.images;
  return SpriteBatch(
    await _images.load(path),
    defaultColor: defaultColor,
    defaultTransform: defaultTransform ?? RSTransform(1, 0, 0, 0),
    defaultBlendMode: defaultBlendMode,
  );
}