isInt function

bool isInt(
  1. String str
)

Checks if the string represents a decimal integer.

Accepts an optional sign, leading zeros, and surrounding whitespace. Hex literals such as 0x10 are rejected.

Returns true if the string is a decimal integer, otherwise returns false.

Example:

isInt('123'); // true
isInt('-123'); // true
isInt('01'); // true
isInt('0x10'); // false
isInt('12.34'); // false
isInt('abc'); // false

Implementation

bool isInt(String str) => _isInt(str);