Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/src/validators/required_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ class RequiredValidator extends Validator<dynamic> {

if (control.value == null) {
return error;
} else if (control.value is String) {
return (control.value as String).trim().isEmpty ? error : null;
} else if (control.value case String string) {
return string.trim().isEmpty ? error : null;
} else if (control.value case Map value) {
return value.isEmpty ? error : null;
} else if (control.value case List value) {
return value.isEmpty ? error : null;
} else if (control.value case Set value) {
return value.isEmpty ? error : null;
Comment thread
simonpham marked this conversation as resolved.
Outdated
} else if (control.value case Iterable value) {
return value.isEmpty ? error : null;
}

return null;
Expand Down