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

Constructors

MinValidator(T min, {required String message})
Creates a MinValidator with a minimum min value and an error message.

Properties

hashCode int
The hash code for this object.
no setterinherited
message String
The error message to be returned when validation fails.
finalinherited
min → T
The minimum allowed value.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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