ceilToMultipleOf method

int ceilToMultipleOf(
  1. int multipleOf
)

Rounds a non-negative integer up to nearest multiple of multipleOf that is greater-than-or-equal-to this integer.

multipleOf must be positive.

Implementation

int ceilToMultipleOf(int multipleOf) {
  assert(this >= 0);
  assert(multipleOf > 0);
  return (this + multipleOf - 1).floorToMultipleOf(multipleOf);
}