LocalAssetLoader class

Convenience class for loading assets from the local file system.

Specify the fontPath, imagePath, and audioPath to load assets from the asset bundle for a specific asset type. Or use path as a general fallback instead. path will only be used for an asset type if the corresponding asset path is null.

For example, to provide an audio asset path:

final riveFile = await RiveFile.asset(
  'assets/ping_pong_audio_demo.riv',
  assetLoader: LocalAssetLoader(
    audioPath: 'assets/some/path',
    // path: 'assets/some/path', // or provide fallback/general
  ),
);

Be sure to provide the correct path where the file is located.

If more control is desired, extend FileAssetLoader and override load.

Inheritance

Constructors

LocalAssetLoader({String? audioPath, String? fontPath, String? imagePath, String? path, AssetBundle? assetBundle})

Properties

audioPath String?
final
fontPath String?
final
hashCode int
The hash code for this object.
no setterinherited
imagePath String?
final
path String?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

load(FileAsset asset, Uint8List? embeddedBytes) Future<bool>
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited