file static method

Future<RiveFile> file(
  1. String path, {
  2. FileAssetLoader? assetLoader,
  3. bool loadCdnAssets = true,
  4. ObjectGenerator? objectGenerator,
})

Imports a Rive file from local path

Provide an assetLoader to load assets from a custom location (out of band assets). See CallbackAssetLoader for an example.

Set loadCdnAssets to false to disable loading assets from the CDN.

Whether an assets is embedded/cdn/referenced is determined by the Rive file - as set in the editor.

Loading assets documentation: https://help.rive.app/runtimes/loading-assets

Whether an assets is embedded/cdn/referenced is determined by the Rive file - as set in the editor.

Implementation

static Future<RiveFile> file(
  String path, {
  FileAssetLoader? assetLoader,
  bool loadCdnAssets = true,
  ObjectGenerator? objectGenerator,
}) async {
  final bytes = await localFileBytes(path);
  return _initTextAndImport(
    ByteData.view(bytes!.buffer),
    assetLoader: assetLoader,
    loadCdnAssets: loadCdnAssets,
    objectGenerator: objectGenerator,
  );
}