asset static method

Future<MorphIconData> asset(
  1. String key, {
  2. AssetBundle? bundle,
  3. bool fit = true,
  4. double grid = 24,
})

Loads an SVG bundled with the app (declared under assets: in your pubspec).

Implementation

static Future<MorphIconData> asset(
  String key, {
  AssetBundle? bundle,
  bool fit = true,
  double grid = 24,
}) {
  final k = _key('asset', key, fit, grid);
  final hit = _cache[k];
  if (hit != null) return SynchronousFuture<MorphIconData>(hit);
  return _pending[k] ??= () async {
    try {
      final source = await (bundle ?? rootBundle).loadString(key);
      return _parse(k, source, fit, grid);
    } finally {
      _pending.remove(k);
    }
  }();
}