load method

  1. @override
Future<LottieComposition> load({
  1. BuildContext? context,
})
override

Implementation

@override
Future<LottieComposition> load({BuildContext? context}) {
  return sharedLottieCache.putIfAbsent(this, () async {
    LottieComposition composition;
    var args = (file, decoder);
    if (backgroundLoading) {
      composition = await compute(_loadFileAndParse, args);
    } else {
      composition = await _loadFileAndParse(args);
    }

    for (var image in composition.images.values) {
      image.loadedImage ??= await _loadImage(composition, image);
    }

    await ensureLoadedFonts(composition);

    return composition;
  });
}