in lib/src/package_config_impl.dart [420:454]
bool _checkConflict(_PackageTrieNode node, SimplePackage newPackage,
void Function(Object error) onError) {
var existingPackage = node.package;
if (existingPackage != null) {
// Trying to add package that is inside the existing package.
// 1) If it's an exact match it's not allowed (i.e. the roots can't be
// the same).
if (newPackage.root.path.length == existingPackage.root.path.length) {
onError(ConflictException(
newPackage, existingPackage, ConflictType.sameRoots));
return true;
}
// 2) The existing package has a packageUriRoot thats inside the
// root of the new package.
if (_beginsWith(0, newPackage.root.toString(),
existingPackage.packageUriRoot.toString())) {
onError(ConflictException(
newPackage, existingPackage, ConflictType.interleaving));
return true;
}
// For internal reasons we allow this (for now). One should still never do
// it thouh.
// 3) The new package is inside the packageUriRoot of existing package.
if (_disallowPackagesInsidePackageUriRoot) {
if (_beginsWith(0, existingPackage.packageUriRoot.toString(),
newPackage.root.toString())) {
onError(ConflictException(
newPackage, existingPackage, ConflictType.insidePackageRoot));
return true;
}
}
}
return false;
}