VersionRange class

Constrains versions to a fall within a given range.

If there is a minimum, then this only allows versions that are at that minimum or greater. If there is a maximum, then only versions less than that are allowed. In other words, this allows >= min, < max.

Version ranges are ordered first by their lower bounds, then by their upper bounds. For example, >=1.0.0 <2.0.0 is before >=1.5.0 <2.0.0 is before >=1.5.0 <3.0.0.

Implemented types

Constructors

VersionRange({Version? min, Version? max, bool includeMin = false, bool includeMax = false, bool alwaysIncludeMaxPreRelease = false})
Creates a new version range from min to max, either inclusive or exclusive.
factory

Properties

hashCode int
The hash code for this object.
no setteroverride
includeMax bool
If true, then max is allowed by the range.
final
includeMin bool
If true then min is allowed by the range.
final
isAny bool
Returns true if this constraint allows all versions.
no setteroverride
isEmpty bool
Returns true if this constraint allows no versions.
no setteroverride
max Version?
The maximum end of the range.
final
min Version?
The minimum end of the range.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

allows(Version other) bool
Tests if other falls within this version range.
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
A string representation of this object.
override
union(VersionConstraint other) VersionConstraint
Returns a VersionConstraint that allows Versions allowed by either this or other.
override

Operators

operator ==(Object other) bool
The equality operator.
override