validate method
Validates the control
.
Implementation
@override
Map<String, dynamic>? validate(AbstractControl<dynamic> control) {
final error = {ValidationMessage.mustMatch: true};
if (control is! FormGroup) {
return error;
}
final formControl = control.control(controlName);
final matchingFormControl = control.control(matchingControlName);
if (formControl.value != matchingFormControl.value) {
matchingFormControl.setErrors(error, markAsDirty: markAsDirty);
matchingFormControl.markAsTouched();
} else {
matchingFormControl.removeError(ValidationMessage.mustMatch);
}
return null;
}