Version class Null safety

Provides immutable storage and comparison of semantic version numbers.

Implemented types

Constructors

Version(int major, int minor, int patch, {List<String> preRelease = const <String>[], String build = ""})
Creates a new instance of Version.

Properties

build String
Build information relevant to the version. Does not contribute to sorting.
final
hashCode int
The hash code for this object.
read-onlyoverride
isPreRelease bool
Indicates that the version is a pre-release. Returns true if preRelease has any segments, otherwise false
read-only
major int
The major number of the version, incremented when making breaking changes.
final
minor int
The minor number of the version, incremented when adding new functionality in a backwards-compatible manner.
final
patch int
The patch number of the version, incremented when making backwards-compatible bug fixes.
final
preRelease List<String>
Pre-release information segments.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

compareTo(Version? other) int
Compares this object to another object.
override
incrementMajor() Version
Creates a new Version with the major version number incremented.
incrementMinor() Version
Creates a new Version with the minor version number incremented.
incrementPatch() Version
Creates a new Version with the patch version number incremented.
incrementPreRelease() Version
Creates a new Version with the right-most numeric preRelease segment incremented. If no numeric segment is found, one will be added with the value "1".
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
Returns a String representation of the Version.
override

Operators

operator <(dynamic o) bool
Determines whether the left-hand Version represents a lower precedence than the right-hand Version.
operator <=(dynamic o) bool
Determines whether the left-hand Version represents an equal or lower precedence than the right-hand Version.
operator ==(dynamic o) bool
Determines whether the left-hand Version represents an equal precedence to the right-hand Version.
override
operator >(dynamic o) bool
Determines whether the left-hand Version represents a greater precedence than the right-hand Version.
operator >=(dynamic o) bool
Determines whether the left-hand Version represents an equal or greater precedence than the right-hand Version.

Static Methods

parse(String? versionString) Version
Creates a Version instance from a string.