preload method

Future<Map<String, PrismLottie>> preload(
  1. List<String> paths
)

Loads and caches each animation.

Implementation

Future<Map<String, PrismLottie>> preload(List<String> paths) async {
  for (final path in paths) {
    if (_cache.containsKey(path)) continue;
    final json = await rootBundle.loadString(path);
    _cache[path] = PrismLottie.fromJson(json);
  }
  return Map.unmodifiable(_cache);
}