cache static method

Future<void> cache(
  1. String assetKey
)

Implementation

static Future<void> cache(String assetKey) async {
  if (_cache.containsKey(assetKey) || _caching.contains(assetKey)) {
    // This asset is already cached or is being cached.
    return;
  }

  _caching.add(assetKey);

  final program = await ui.FragmentProgram.fromAsset(assetKey);
  _cache[assetKey] = program;

  _caching.remove(assetKey);
}