file static method

Future<MorphIconData> file(
  1. String path, {
  2. bool fit = true,
  3. double grid = 24,
})

Loads an SVG from the file system.

Not available on the web — use memory there.

Implementation

static Future<MorphIconData> file(
  String path, {
  bool fit = true,
  double grid = 24,
}) {
  final k = _key('file', path, fit, grid);
  final hit = _cache[k];
  if (hit != null) return SynchronousFuture<MorphIconData>(hit);
  return _pending[k] ??= () async {
    try {
      final bytes = await loadFileBytes(path);
      return _parse(k, utf8.decode(bytes, allowMalformed: true), fit, grid);
    } finally {
      _pending.remove(k);
    }
  }();
}