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;
    if (backgroundLoading) {
      composition = await compute(parseJsonBytes, (bytes, decoder));
    } else {
      composition =
          await LottieComposition.fromBytes(bytes, decoder: decoder);
    }
    for (var image in composition.images.values) {
      image.loadedImage ??= await _loadImage(composition, image);
    }

    await ensureLoadedFonts(composition);

    return composition;
  });
}