I want to check if the value that the user enters in a TextFormField contains at least one String in another given String.
As an example, if the given String value is 0123456789 and if the user enters Ab3 in the TextFormField, how to check if the user entered value contains at least one String in the given String?
String allowedChar = "0123456789";
final split = allowedChar.split('');
I tried splitting the given value like this and checked if the textEditingController.text contains the value for each splitted value of allowedChar.
if (_value.isNotEmpty &&
textEditingController.text.contains(c)) {
_areAlwdCharsTyped = true;
} else if (!textEditingController.text.contains(c)) {
_areAlwdCharsTyped = false;
}
But _areAlwdCharsTyped always returns false. Could I know a way to achieve this please? Thanks in advance.