mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
22 lines
487 B
Dart
22 lines
487 B
Dart
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
class SvgUtils {
|
|
static List<String> allSvgs = [
|
|
'icons/fladder_icon.svg',
|
|
'icons/fladder_icon_outline.svg',
|
|
];
|
|
|
|
static Future<void> preCacheSVGs() async {
|
|
try {
|
|
for (final path in allSvgs) {
|
|
final loadSvg = SvgAssetLoader(path);
|
|
await svg.cache.putIfAbsent(
|
|
loadSvg.cacheKey(null),
|
|
() => loadSvg.loadBytes(null),
|
|
);
|
|
}
|
|
} catch (e) {
|
|
print(e);
|
|
}
|
|
}
|
|
}
|