describe method
Loads the (possibly remote) pubspec for the package version identified by
id
.
This may be called for packages that have not yet been downloaded during the version resolution process. Its results are automatically memoized.
Throws a DataException
if the pubspec's version doesn't match id
's
version.
Implementation
Future<Pubspec> describe(PackageId id) async {
final pubspec = cachedPubspecs[id] ??= await id.source.doDescribe(id, this);
if (pubspec.version != id.version) {
throw PackageNotFoundException(
'the pubspec for $id has version ${pubspec.version}',
);
}
return pubspec;
}