toIntOrNull method

int? toIntOrNull({
  1. int? radix,
})

Parses the string as an int, or returns null if it is not valid.

Example:

'42'.toIntOrNull(); // 42
'abc'.toIntOrNull(); // null

Implementation

int? toIntOrNull({int? radix}) => int.tryParse(trim(), radix: radix);