toInt property
int?
toInt
Converts the string to an integer. Returns null if the conversion fails.
Example:
print('12'.toInt); // Output: 12
print('12.34'.toInt); // Output: 12 (truncated conversion)
print('abc'.toInt); // Output: null
Implementation
int? get toInt => toNum?.toInt();