load static method

Future<Svg> load(
  1. String fileName, {
  2. AssetsCache? cache,
  3. double? pixelRatio,
})

Loads an Svg with the received cache. When no cache is provided, the global Flame.assets is used.

Implementation

static Future<Svg> load(
  String fileName, {
  AssetsCache? cache,
  double? pixelRatio,
}) async {
  cache ??= Flame.assets;
  final svgString = await cache.readFile(fileName);
  final pictureInfo = await vg.loadPicture(SvgStringLoader(svgString), null);
  return Svg(
    pictureInfo,
    pixelRatio: pixelRatio,
  );
}