Name of the package to retrieve. Subpackages will lead to the main package being retrieved and the subpackage being returned (if it exists).
The VersionRange to match. Default to Any to fetch the latest version.
A set of options used for fetching / matching versions.
Where to store the retrieved package. Default to the configured defaultPlacementLocation.
Optionally, the reason for retriving this package. This is used only for logging.
The fetched or loaded Package, or null in dry-run mode.
If the package cannot be fetched or loaded.
Fetches a missing package and stores it locally
This will query the configured PackageSuppliers for a package matching the range specification, store it locally, and load it in the PackageManager. Note that unlike the command line version, this function is not idempotent and will remove an existing package and re-download it.