toInt function
Returns an int from a String if it is a numeric value
Implementation
int? toInt(dynamic s) {
try {
if (s == null) return null;
if (s is int) return s;
num? n = toNum(s);
if (n != null) n = n.round();
return n as int?;
} catch (e) {
return null;
}
}