in lib/src/discovery.dart [56:93]
Future<PackageConfig?> findPackageConfigUri(
Uri location,
Future<Uint8List?> Function(Uri uri)? loader,
void Function(Object error) onError,
bool recursive) async {
if (location.isScheme('package')) {
onError(PackageConfigArgumentError(
location, 'location', 'Must not be a package: URI'));
return null;
}
if (loader == null) {
if (location.isScheme('file')) {
return findPackageConfig(
Directory.fromUri(location.resolveUri(currentPath)),
recursive,
onError);
}
loader = defaultLoader;
}
if (!location.path.endsWith('/')) location = location.resolveUri(currentPath);
while (true) {
var file = location.resolveUri(packageConfigJsonPath);
var bytes = await loader(file);
if (bytes != null) {
return parsePackageConfigBytes(bytes, file, onError);
}
file = location.resolveUri(dotPackagesPath);
bytes = await loader(file);
if (bytes != null) {
return packages_file.parse(bytes, file, onError);
}
if (!recursive) break;
var parent = location.resolveUri(parentPath);
if (parent == location) break;
location = parent;
}
return null;
}