loadAsset method

Future<String> loadAsset(
  1. String relativePath
)

Loads an asset from the package using multiple resolution strategies.

relativePath - Path relative to the package root

Returns the file content as a string. Throws AssetLoaderException if the asset cannot be found.

Implementation

Future<String> loadAsset(String relativePath) async {
  // Check cache first
  if (_cache.containsKey(relativePath)) {
    return _cache[relativePath]!;
  }

  final content = await _loadFromPackage(relativePath);
  _cache[relativePath] = content;
  return content;
}