min static method
FormFieldValidator that requires the field's value to be greater than or equal to the provided number.
Implementation
static FormFieldValidator min(
num min, {
String? errorText,
}) {
return (valueCandidate) {
if (valueCandidate != null &&
((valueCandidate is num && valueCandidate < min) ||
(valueCandidate is String &&
num.tryParse(valueCandidate) != null &&
num.tryParse(valueCandidate)! < min))) {
return errorText ?? "Value must be greater than or equal to $min";
}
return null;
};
}