asset static method
Future<MorphIconData>
asset(
- String key, {
- AssetBundle? bundle,
- bool fit = true,
- 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);
}
}();
}