isNumericAndPositive function

bool isNumericAndPositive (String s)

Implementation

bool isNumericAndPositive(String s) {
  int parsedInt;
  if (s == null) {
    return false;
  }
  try {
    parsedInt = int.parse(s);
  } catch (FormatException) {
    return false;
  }

  return parsedInt > 0;
}