measureText static method

double measureText(
  1. String str,
  2. double size
)

Implementation

static double measureText(String str, double size) {
  int width = 0;
  for (int i = 0; i < str.length; i++) {
    int code = str.codeUnitAt(i);
    width += (code >= 32 && code <= 126) ? _widths[code - 32] : 556;
  }
  return (width * size) / 1000.0;
}