RangeValidator<T extends num> class

A validator that checks if a numeric value falls within a specified range.

RangeValidator ensures values are between minimum and maximum bounds. Both bounds can be inclusive or exclusive depending on configuration.

Example:

RangeValidator<double>(
  0.0,
  100.0,
  inclusive: true,
  message: 'Must be between 0 and 100',
)
Inheritance

Constructors

RangeValidator(T min, T max, {bool inclusive = true, String? message})
Creates a RangeValidator with the specified min and max bounds.
const

Properties

hashCode int
The hash code for this object.
no setteroverride
inclusive bool
Whether the bounds are inclusive (true) or exclusive (false).
final
max → T
The maximum acceptable value.
final
message String?
Custom error message, or null to use default localized message.
final
min → T
The minimum acceptable value.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

combine(Validator<T> other) Validator<T>
Combines this validator with another validator using AND logic.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldRevalidate(FormKey source) bool
Determines if this validator should be re-run when the specified form key changes.
inherited
toString() String
A string representation of this object.
inherited
validate(BuildContext context, T? value, FormValidationMode state) FutureOr<ValidationResult?>
Validates the given value and returns a validation result.
override

Operators

operator &(Validator<T> other) Validator<T>
Combines this validator with another using AND logic (alias for combine).
inherited
operator +(Validator<T> other) Validator<T>
Combines this validator with another using AND logic (alias for combine).
inherited
operator ==(Object other) bool
The equality operator.
override
operator unary-() Validator<T>
Negates this validator's result (alias for ~ operator).
inherited
operator |(Validator<T> other) Validator<T>
Combines this validator with another using OR logic.
inherited
operator ~() Validator<T>
Negates this validator's result.
inherited