ContainsValidator constructor

const ContainsValidator(
  1. String contains, {
  2. bool caseSensitive = true,
  3. String? errorMessage,
})

A validator that checks if a value contains a specified string. This validator is used to validate strings and other types that have a length property. It returns an error message if the value does not contain the specified string. The contains parameter specifies the desired string that the value should contain. Example usage:

final validator = ContainsValidator('Hello','Value must contain Hello');
String? result = validator.validate("test");
print(result); // 'Value must contain Hello'

Implementation

const ContainsValidator(
  this.contains, {
  this.caseSensitive = true,
  String? errorMessage,
}) : super(errorMessage);