toInt static method
Converts a value to an integer.
Example: '42' -> 42
Implementation
static int toInt(Object? value) {
if (value is String) {
return int.tryParse(value) ?? 0;
} else if (value is int) {
return value;
} else if (value is double) {
return value.toInt();
} else {
return 0;
}
}