MinWordCountValidator constructor
A validator that checks if the number of words in a value is greater than or equal to a specified minimum word count.
This validator is used to validate strings and other types that have a length property. It returns an error message if the value is shorter than the specified minimum word count.
Example usage:
final validator = MinWordCountValidator(2, 'Value must have at least 2 words');
validator.validate('hello world'); // returns null
validator.validate('hi'); // returns 'Value must have at least 2 words'
Implementation
const MinWordCountValidator(this.minWordCount, [super.errorMessage]);