load static method

Future<Svg> load(
  1. String fileName, {
  2. AssetsCache? cache,
  3. double? pixelRatio,
  4. bool fixedRatio = false,
  5. int cacheSize = defaultCacheSize,
  6. String? package,
})

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,
  bool fixedRatio = false,
  int cacheSize = defaultCacheSize,
  String? package,
}) async {
  cache ??= Flame.assets;
  final svgString = await cache.readFile(fileName, package: package);
  return Svg.loadFromString(
    svgString,
    pixelRatio: pixelRatio,
    fixedRatio: fixedRatio,
    cacheSize: cacheSize,
  );
}