toInt property

int? get toInt

Parses the string as an integer, or returns null if invalid.

Example:

'42'.toInt; // 42
'abc'.toInt; // null

Implementation

int? get toInt => int.tryParse(this);