defaultForPackage static method
Creates a loader that resolves the avatar_builder_core package's
built-in asset directory automatically.
Uses Isolate.resolvePackageUri to locate the package on disk,
which works for dart run, dart test, and compiled executables
when a .dart_tool/package_config.json is available.
Implementation
static Future<FileAssetLoader> defaultForPackage() async {
final uri = await Isolate.resolvePackageUri(
Uri.parse('package:avatar_builder_core/assets/'),
);
if (uri == null) {
throw StateError(
'Could not resolve avatar_builder_core asset directory. '
'Use FileAssetLoader(path) with an explicit path instead.',
);
}
return FileAssetLoader(uri.toFilePath());
}