Version class Null safety

A parsed semantic version number.

Implemented types
Annotations

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

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 non-existent 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".
read-only

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. [...]