equalTo method

FormFieldValidator<String> equalTo (
  1. dynamic value,
  2. {String message}
)

Implementation

static FormFieldValidator<String> equalTo(dynamic value, {String message}) {
  return (fieldValue) {
    var valueToCompare;
    if (value is TextEditingController) {
      valueToCompare = value.text;
    } else {
      valueToCompare = value;
    }
    if (Validator.isEqualTo(fieldValue, valueToCompare)) {
      return null;
    } else {
      return message ?? "Values do not match";
    }
  };
}