Skip to content

Commit c25ef36

Browse files
committed
Refactored minWordsCount Validator
1 parent 0487cce commit c25ef36

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/src/form_builder_validators.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,8 @@ class FormBuilderValidators {
183183
return (valueCandidate) {
184184
int valueWordsCount = 0;
185185

186-
if (valueCandidate != null) {
187-
if (valueCandidate.trim().isEmpty) {
188-
valueWordsCount = 0;
189-
} else {
190-
valueWordsCount = valueCandidate.trim().split(' ').length;
191-
}
186+
if (valueCandidate != null && valueCandidate.trim().isNotEmpty) {
187+
valueWordsCount = valueCandidate.trim().split(' ').length;
192188
}
193189

194190
return valueWordsCount < minCount && (!allowEmpty || valueWordsCount > 0)

0 commit comments

Comments
 (0)