EqualToValidator constructor

const EqualToValidator(
  1. String equalTo, {
  2. bool caseSensitive = true,
  3. bool useTrim = false,
  4. String? errorMessage,
})

A validator that checks if a value is equal to another value. This validator is used to validate strings and other types that have a length property. It returns an error message if the value is not equal to another value. Example usage:

final validator = EqualToValidator('Hello', errorMessage: 'Value must be equal to Hello');
String? result = validator.validate("test");
print(result); // 'Value must be equal to Hello'

Implementation

const EqualToValidator(
  this.equalTo, {
  this.caseSensitive = true,
  this.useTrim = false,
  String? errorMessage,
}) : super(errorMessage);