isInt property

bool get isInt

Checks if the string represents a valid integer.

Uses Dart's int.tryParse to determine if the string can be parsed as an integer. This supports both positive and negative integers, as well as leading zeros.

Returns true if the string can be converted to an integer, otherwise returns false.

Example:

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

Implementation

bool get isInt {
  return _isInt(this);
}