resolveVersions function
Attempts to select the best concrete versions for all of the transitive
dependencies of root taking into account all of the VersionConstraints
that those dependencies place on each other and the requirements imposed by
lockFile.
If unlock is given, then only packages listed in unlock will be unlocked
from lockFile. This is useful for a upgrading specific packages only.
If unlock is empty SolveType.get interprets this as lock everything,
while SolveType.upgrade and SolveType.downgrade interprets an empty
unlock as unlock everything.
additionalConstraints can contain a list of extra constraints for this
resolution.
Implementation
Future<SolveResult> resolveVersions(
SolveType type,
SystemCache cache,
Package root, {
LockFile? lockFile,
Iterable<String> unlock = const [],
Map<String, Version> sdkOverrides = const {},
Iterable<ConstraintAndCause>? additionalConstraints,
}) {
lockFile ??= LockFile.empty();
final solver = VersionSolver(
type,
cache,
root,
lockFile,
unlock,
sdkOverrides: sdkOverrides,
);
if (additionalConstraints != null) {
solver.addConstraints(additionalConstraints);
}
return solver.solve();
}