load static method

Future<ParallaxImage> load(
  1. String path, {
  2. ImageRepeat repeat = ImageRepeat.repeatX,
  3. Alignment alignment = Alignment.bottomLeft,
  4. LayerFill fill = LayerFill.height,
  5. Images? images,
  6. FilterQuality? filterQuality,
  7. String? package,
})

Takes the full path of an image, and optionally arguments for how the image should repeat (repeat), which edge it should align with (alignment), which axis it should fill the image on (fill) and images which is the image cache that should be used. If no image cache is set, the global flame cache is used.

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

Implementation

static Future<ParallaxImage> load(
  String path, {
  ImageRepeat repeat = ImageRepeat.repeatX,
  Alignment alignment = Alignment.bottomLeft,
  LayerFill fill = LayerFill.height,
  Images? images,
  FilterQuality? filterQuality,
  String? package,
}) async {
  images ??= Flame.images;
  return ParallaxImage(
    await images.load(path, package: package),
    repeat: repeat,
    alignment: alignment,
    fill: fill,
    filterQuality: filterQuality,
  );
}