isStringNumeric method

bool isStringNumeric()

Returns true if a string is made up of only numbers.

Implementation

bool isStringNumeric() {
  final RegExp regExp = RegExp(r"[^\d.]+");
  final String numStr = replaceAll(regExp, "");
  return numStr.length == length;
}