passes method
Validates the value using the given context.
Returns true if valid, otherwise false.
Implementation
@override
FutureOr<bool> passes(ValidationContext context) {
final args = context.parameters;
final data = context.data;
if (args.isEmpty) return false;
final otherField = args[0];
if (!data.containsKey(otherField)) {
// If other field is missing, strictly it relies on how we define "different".
// Laravel: "The given field must be different than the field under validation."
// If other field is null/missing, and this field is not null, they are different.
return true;
}
final otherValue = data[otherField];
final value = context.value;
return value != otherValue;
}