Index: sdk/lib/_internal/pub/lib/src/version.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/version.dart b/sdk/lib/_internal/pub/lib/src/version.dart |
index 7e33fe2de8e0909e22e88bcdf70c7ad9b4444888..50cfb0c57123c22b22bbf0f65164932f6e1d86f9 100644 |
--- a/sdk/lib/_internal/pub/lib/src/version.dart |
+++ b/sdk/lib/_internal/pub/lib/src/version.dart |
@@ -54,6 +54,18 @@ class Version implements Comparable<Version>, VersionConstraint { |
return a.compareTo(b); |
} |
+ /// Like [proiritize], but lower version numbers are considered greater than |
+ /// higher version numbers. |
+ /// |
+ /// This still considers prerelease versions to be lower than non-prerelease |
+ /// versions. |
+ static int antiPrioritize(Version a, Version b) { |
+ if (a.isPreRelease && !b.isPreRelease) return -1; |
+ if (!a.isPreRelease && b.isPreRelease) return 1; |
+ |
+ return b.compareTo(a); |
+ } |
+ |
/// The major version number: "1" in "1.2.3". |
final int major; |