AssetLoader class

A configurable asset bundler for loading files from Dart packages.

This bundler can be configured to load assets from any Dart package, making it flexible for different use cases. It provides a clean API for loading package assets with proper error handling and caching.

Example usage:

// For JetLeaf package
final jetAssetLoader = AssetLoader.forJetLeaf();
final html = await jetAssetLoader.load('resources/html/404.html');

// For custom package
final myAssetLoader = AssetLoader.forPackage('my_package');
final config = await myAssetLoader.load('config/settings.json');
Implemented types

Constructors

AssetLoader.forJetLeaf()
Creates a new asset bundler specifically for the JetLeaf package.
factory
AssetLoader.forPackage(String packageName)
Creates a new asset bundler for the specified package.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
packageName String
Gets the configured package name.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearCache() → void
Clears the internal cache.
override
exists(String relativePath) Future<bool>
Checks if an asset exists without loading it.
override
getPackageRoot() Future<String?>
Gets the package root path for debugging purposes.
override
load(String relativePath) Future<String>
Loads an asset from the configured package as a string.
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