numeric method

FormFieldValidator numeric ({String errorText: "Value must be numeric." })

FormFieldValidator that requires the field's value to be a valid number.

Implementation

static FormFieldValidator numeric({
  String errorText = "Value must be numeric.",
}) {
  return (valueCandidate) {
    if (num.tryParse(valueCandidate) == null && valueCandidate.isNotEmpty)
      return errorText;
    return null;
  };
}