Version class

A parsed semantic version number.

Implemented types
Annotations
  • @sealed

Constructors

Version(int major, int minor, int patch, {String? pre, String? build})
Creates a new Version object.
factory
Version.parse(String text)
Creates a new Version by parsing text.
factory

Properties

build List<Object>
The build identifier: "foo" in "1.2.3+foo".
final
canonicalizedVersion String
Get a canonicalized string representation of this Version.
no setter
firstPreRelease Version
Returns the first possible pre-release of this version.
no setter
hashCode int
The hash code for this object.
no setteroverride
includeMax bool
If true, then max is allowed by the range.
no setteroverride
includeMin bool
If true then min is allowed by the range.
no setteroverride
isAny bool
Returns true if this constraint allows all versions.
no setteroverride
isEmpty bool
Returns true if this constraint allows no versions.
no setteroverride
isFirstPreRelease bool
Returns whether this is the first possible pre-release of its version.
no setter
isPreRelease bool
Whether or not this is a pre-release version.
no setter
major int
The major version number: "1" in "1.2.3".
final
max Version
The maximum end of the range.
no setteroverride
min Version
The minimum end of the range.
no setteroverride
minor int
The minor version number: "2" in "1.2.3".
final
nextBreaking Version
Gets the next breaking version number that follows this one.
no setter
nextMajor Version
Gets the next major version number that follows this one.
no setter
nextMinor Version
Gets the next minor version number that follows this one.
no setter
nextPatch Version
Gets the next patch version number that follows this one.
no setter
patch int
The patch version number: "3" in "1.2.3".
final
preRelease List<Object>
The pre-release identifier: "foo" in "1.2.3-foo".
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

allows(Version other) bool
Tests if other matches this version exactly.
override
allowsAll(VersionConstraint other) bool
Returns true if this constraint allows all the versions that other allows.
override
allowsAny(VersionConstraint other) bool
Returns true if this constraint allows any of the versions that other allows.
override
compareTo(VersionRange other) int
Compares this object to another object.
override
difference(VersionConstraint other) VersionConstraint
Returns a VersionConstraint that allows Versions allowed by this but not other.
override
intersect(VersionConstraint other) VersionConstraint
Returns a VersionConstraint that only allows Versions allowed by both this and other.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Get non-canonical string representation of this Version.
override
union(VersionConstraint other) VersionConstraint
Returns a VersionConstraint that allows Versions allowed by either this or other.
override

Operators

operator <(Version other) bool
operator <=(Version other) bool
operator ==(Object other) bool
The equality operator.
override
operator >(Version other) bool
operator >=(Version other) bool

Static Properties

none Version
No released version: i.e. "0.0.0".
no setter

Static Methods

antiprioritize(Version a, Version b) int
Like prioritize, but lower version numbers are considered greater than higher version numbers.
primary(List<Version> versions) Version
Returns the primary version out of versions.
prioritize(Version a, Version b) int
Compares a and b to see which takes priority over the other.