asset static method

Future<File?> asset(
  1. String bundleKey, {
  2. required Factory riveFactory,
  3. AssetBundle? bundle,
  4. AssetLoaderCallback? assetLoader,
})

Imports a Rive file from an asset bundle.

Implementation

static Future<File?> asset(
  String bundleKey, {
  required Factory riveFactory,
  AssetBundle? bundle,
  AssetLoaderCallback? assetLoader,
}) async {
  final bytes = await (bundle ?? rootBundle).load(
    bundleKey,
  );

  final file = await decode(
    bytes.buffer.asUint8List(),
    riveFactory: riveFactory,
    assetLoader: assetLoader,
  );
  return file;
}