MinValidator<T extends num> class
A validator that ensures a given num value meets a specified minimum limit.
The MinValidator checks if the provided value is greater than or equal to min.
If the value is within the allowed range, validation passes (null is returned).
Otherwise, it returns the provided error message.
Example
final validator = MinValidator(10, message: 'Value must be at least 10');
print(validator.validate(15)); // null (valid)
print(validator.validate(10)); // null (valid)
print(validator.validate(9)); // 'Value must be at least 10' (invalid)
print(validator.validate(null)); // 'Value must be at least 10' (invalid)
- Inheritance
-
- Object
- Validator<
T> - ValidatorWithMessage<
T> - MinValidator
Constructors
- MinValidator(T min, {required String message})
-
Creates a
MinValidatorwith a minimumminvalue and an errormessage.
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
covariant T value) → String? -
Validates the provided
value.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited