toInt method

int? toInt({
  1. int? base,
})

Returns either int or null. Takes base as parameters depending on base like 2, 8, 16. default base is 10.

"xyz".toInt();          // null
"12".toInt();           // 12
"12E".toInt(radix: 16); // 12E

Implementation

int? toInt({int? base}) => int.tryParse(this, radix: base);