Skip to content

Commit b585c61

Browse files
committed
Fix
1 parent 37004c0 commit b585c61

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

lib/src/base_validator.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ abstract class BaseValidator<T> {
4848

4949
/// Validates the value.
5050
/// Returns `null` if the value is valid, otherwise an error message.
51+
/// Call validate() instead of this method when using the validator.
5152
String? validateValue(T valueCandidate);
5253
}

lib/src/collection/max_words_count_validator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class MaxWordsCountValidator extends BaseValidator<String> {
1919

2020
@override
2121
String? validateValue(String valueCandidate) {
22-
final int wordsCount = valueCandidate.trim().split(' ').length ?? 0;
22+
final int wordsCount = valueCandidate.trim().split(' ').length;
2323

2424
return wordsCount > maxWordsCount ? errorText : null;
2525
}

lib/src/collection/min_words_count_validator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class MinWordsCountValidator extends BaseValidator<String> {
1919

2020
@override
2121
String? validateValue(String valueCandidate) {
22-
final int wordsCount = valueCandidate.trim().split(' ').length ?? 0;
22+
final int wordsCount = valueCandidate.trim().split(' ').length;
2323

2424
return wordsCount < minWordsCount ? errorText : null;
2525
}

0 commit comments

Comments
 (0)