maxWords static method
Validates maximum word count.
Implementation
static String? maxWords(String? value, int max, {String? fieldName}) {
if (value == null || value.isEmpty) {
return null;
}
final wordCount = _countWords(value);
if (wordCount > max) {
return '${fieldName ?? "This field"} must not exceed $max words.';
}
return null;
}