We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ca36a0 commit d501e65Copy full SHA for d501e65
lib/src/form_builder_validators.dart
@@ -727,10 +727,16 @@ class FormBuilderValidators {
727
/// * [caseSensitive] is a `bool` that sets if the search is case sensitive. By default `true`
728
static FormFieldValidator<String> contains({
729
required String substring,
730
+ bool caseSensitive = true,
731
String? errorText,
732
}) =>
733
(valueCandidate) => true == valueCandidate?.isNotEmpty &&
- !valueCandidate!.contains(substring)
734
+ caseSensitive &&
735
+ !valueCandidate!.contains(substring) ||
736
+ !caseSensitive &&
737
+ !valueCandidate!
738
+ .toLowerCase()
739
+ .contains(substring.toLowerCase())
740
? errorText ??
741
FormBuilderLocalizations.current.containsErrorText(substring)
742
: null;
0 commit comments