notEqual static method

String? notEqual(
  1. String? value,
  2. String? otherValue, {
  3. String? message,
})

Validates that the value is not equal to another value

Example:

Validators.notEqual(value, 'forbidden');

Implementation

static String? notEqual(
  String? value,
  String? otherValue, {
  String? message,
}) {
  if (value == null || value.isEmpty) return null;
  if (value == otherValue) {
    return message ?? 'Value must be different';
  }
  return null;
}