isInt function

bool isInt(
  1. String character
)

This method returns a boolean value (either true or false) of whether a character is an integer.

Implementation

bool isInt(String character) {
  bool result = true;
  try {
    int charInt = int.tryParse(character) as int;
    assert(charInt is int);
  } catch (e) {
    result = false;
  }
  return result;
}