isValid method
Checks if the value contains the substring.
Returns null if the value contains the substring, otherwise returns
the error message.
Implementation
@override
String? isValid(BuildContext context, String? value) {
return value != null && value.contains(substring)
? null
: errorMessage ??
defaultMessage[Localizations.localeOf(context).languageCode] ??
defaultMessage['en'];
}