isInt property

bool get isInt

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:

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

Implementation

bool get isInt {
  return _isInt(this);
}