round static method
Returns the closest int to the argument a
, with ties rounding to positive infinity.
Implementation
static num round(num a) {
if (a is int) return a;
if (a is double) {
if (a.isNaN || a.isInfinite) return a;
}
var n = a.toInt();
if (a == n) return n;
var diff = a - n;
return (diff >= 0.5) ? n + 1 : n;
}