stringContains function
Validates that the String contains substring
This validator also validates that the value is a String first
So there's no need to add the isTypeString
validator when using this validator
Implementation
Validator stringContains(String substring) {
return (value) {
final isString = isType<String>().call(value);
if (isString.isNotValid) return isString;
return Result(
isValid: (value as String).contains(substring),
expected: 'String to contain "$substring"',
value: value,
);
};
}