getLatestVersionInCacheFor static method

Version getLatestVersionInCacheFor(
  1. String packageName
)

Implementation

static Version getLatestVersionInCacheFor(String packageName) {
  final allVersions = getAllPackageVersionsForPackageInCache(packageName);
  final versions = allVersions.keys.toList(growable: false);
  if (versions.isEmpty) {
    throw RunDartError('No version of $packageName found');
  }

  return versions.reduce((v1, v2) => v1 > v2 ? v1 : v2);
}