How to convert a double to an int in Dart?
dart
Solution
Round it using the `round()` method:
int calc_ranks(ranks) {
double multiplier = .5;
return (multiplier * ranks).round();
}
Problem
The following produces the below error: ``` int calc_ranks(ranks) { double multiplier = .5; return multiplier * ranks; } ``` The return type `double` is not a `int`, as defined by the method `calc_ranks`. How do I round/cast to an `int`?