MinValidator<T extends num> class
A validator that checks if a numeric value meets a minimum threshold.
MinValidator ensures that numeric values are greater than (or equal to) a specified minimum value. Useful for enforcing minimum quantities, ages, etc.
Example:
MinValidator<int>(
18,
inclusive: true,
message: 'Must be at least 18 years old',
)
Constructors
- MinValidator(T min, {bool inclusive = true, String? message})
-
Creates a MinValidator with the specified minimum value.
const
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- inclusive → bool
-
Whether the minimum value itself is acceptable (true) or must be exceeded (false).
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
valueand 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