maxValue method

FormFieldValidator<String> maxValue (
  1. {double maxValue,
  2. String message}
)

Implementation

static FormFieldValidator<String> maxValue(
    {double maxValue, String message}) {
  return (fieldValue) {
    if (fieldValue.trim().isEmpty)
      return message ?? "Field must be lesser than $maxValue";
    double dFieldValue = double.parse(fieldValue
        .replaceAll(" ", "")
        .replaceAll(",", "")
        .replaceAll(".", ""));
    if (Validator.maxValue(dFieldValue, maxValue)) {
      return null;
    } else {
      return message ?? "Field must be lesser than $maxValue";
    }
  };
}