toInt method
Implementation
int toInt(Object value) {
if (value is int) {
return value;
} else if (value is double) {
return value.floor();
} else if (value is bool) {
return value ? 1 : 0;
} else if (value is String) {
return int.parse(value);
} else {
throw FormatException("Can't convert a value of type ${value.runtimeType} to an integer");
}
}