roundToMultipleOf method
Rounds a non-negative integer to the nearest multiple of multipleOf
.
multipleOf
must be positive.
Implementation
int roundToMultipleOf(int multipleOf) {
assert(this >= 0);
assert(multipleOf > 0);
return (this + multipleOf ~/ 2).floorToMultipleOf(multipleOf);
}