SdkVersionConstraint class
Parses and evaluates a Dart/Flutter SDK version constraint expression.
Delegates all constraint matching to TemplateSemVer.satisfies() to avoid duplicating version logic. The primary role of this class is:
- Validate that a constraint string is well-formed and parseable.
- Evaluate whether a concrete SDK version satisfies the constraint.
- Provide human-readable descriptions of the constraint for diagnostics.
Supported Constraint Syntax
Inherits all forms supported by TemplateSemVer.satisfies():
*— any version>=1.0.0 <2.0.0— compound range^1.0.0— caret (same major)>=1.0.0,>1.0.0,<=1.0.0,<1.0.01.0.0or=1.0.0— exact version
Security
This class must never expose SDK install paths, file system state, or process environment. It accepts version strings as pure text values and performs only arithmetic comparison.
Constructors
- SdkVersionConstraint.parse(String constraint)
-
Parses
constraintand returns a validated SdkVersionConstraint.factory
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- isWildcard → bool
-
Whether this constraint accepts any version (wildcard
*or empty).final - raw → String
-
The raw constraint string exactly as declared.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
isSatisfiedBy(
String version) → bool -
Returns true if
versionsatisfies this constraint. -
isSatisfiedBySafe(
String version) → bool? -
Evaluates compatibility without throwing.
Returns
nullifversioncannot be parsed. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override