loadSvg static method

Future<SvgData> loadSvg(
  1. String path, [
  2. String? cacheId
])

A static method to load an SVG image from a file.

This method takes the path to the SVG file and an optional cacheId. If the cacheId is not null it will return the cached SVG data. Otherwise, it will load the SVG.

Implementation

static Future<SvgData> loadSvg(
  String path, [
  String? cacheId,
]) async {
  cacheId ??= path;
  svgCache[cacheId] =
      await SvgUtils.svgDataFromString(await loadString(path));
  return svgCache[cacheId]!;
}