plan method
Reads the project, resolves the requested Profile, and returns what
apply would write. Writes nothing in the project. Resolving may
clone or refresh Profile sources in the Profile cache, each as
AdoptionRequest.allowFetch allows; an offline request reads the
cache as it is. A fetch it may not make throws
ProfileFetchRequiredException (fetch-required) naming it.
The Profile is the one the package at the request's source declares;
a request that names another throws AdoptionProfileConflictException
(adoption-profile-conflict). The bundle as applying leaves it is
judged once, through the adoption's KnowledgeAssessor, which gets
cancel and whose failures, such as assessment-timeout, planning
throws.
Throws adoption-invalid for a request that cannot describe an
adoption, such as a malformed bundle path, source, seed concept or
host input; adoption-failed when the project or Git cannot be read;
and the resolver's codes, such as profile-unresolved, when the
Profile does not resolve. What the project holds is reported as
KnowledgeAdoptionPlan.conflicts.
Implementation
Future<KnowledgeAdoptionPlan> plan(
AdoptionRequest request, {
WayfinderCancellation? cancel,
}) async {
try {
return await _plan(request, cancel);
} on FileSystemException catch (error) {
throw WayfinderException(
'adoption-failed',
'Adoption could not be planned: ${error.message}'
'${error.path == null ? '' : ' (${error.path})'}.',
);
} on ProcessException catch (error) {
throw WayfinderException(
'adoption-failed',
'Adoption could not be planned: ${error.executable} could not run: '
'${error.message}.',
);
}
}