assetIdToPackageUri function
Converts id
to a "package:" URI.
This will return a schemeless URI if id
doesn't represent a library in
lib/
.
Implementation
Uri assetIdToPackageUri(AssetId id) {
if (!id.path.startsWith('lib/')) return Uri(path: id.path);
return Uri(
scheme: 'package',
path: path.url.join(id.package, id.path.replaceFirst('lib/', '')));
}