isNumerical method Null safety

Validator isNumerical(
  1. {String message = "Validator.isNumerical"}
)

Returns a Validator that accepts a value that is comprised of only numbers, or empty.

accepts

null, "", " ", "0", " 0", "0 ", "0 1"

rejects

"0xFFFFFF"

Implementation

Validator isNumerical({
  String message = "Validator.isNumerical",
}) {
  var source = r"^([0-9]* *)*$";
  return copy().matches(RegExp(source), message: message);
}