matchValidator function

String? Function(String?) matchValidator(
  1. String otherValue,
  2. String fieldName
)

Validates that the value matches another value (for password confirmation).

Implementation

String? Function(String?) matchValidator(String otherValue, String fieldName) {
  return (value) {
    if (value == null || value != otherValue) {
      return '$fieldName does not match';
    }
    return null;
  };
}