quantizeWidth static method

int quantizeWidth(
  1. double width, {
  2. int step = 24,
})

Buckets width into steps (default 24px) to limit cache key cardinality without losing meaningful layout precision.

Implementation

static int quantizeWidth(double width, {int step = 24}) {
  if (step <= 0) return width.round();
  return (width / step).floor();
}