minLength method Null safety
Returns a Validator that accepts a value that is longer or of equal length to length
.
If the value is null, its length is treated as zero.
If trim
is true
leading and trailing spaces will be ignored.
Implementation
Validator minLength(
int length, {
bool trim = false,
String message = "Validator.minLength",
}) {
return add(
(value) {
var v = trim ? (value ?? "").trim() : (value ?? "");
return v.length < length ? message : null;
},
);
}