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 (val) {
    if (num.tryParse(val) == null && val.isNotEmpty) return errorText;
  };
}