indentWidth function

int indentWidth(
  1. String line
)

Number of leading-indent columns (space = 1, tab = 4).

Implementation

int indentWidth(String line) {
  var w = 0;
  for (var i = 0; i < line.length; i++) {
    final c = line.codeUnitAt(i);
    if (c == _space) {
      w += 1;
    } else if (c == _tab) {
      w += 4;
    } else {
      break;
    }
  }
  return w;
}