indentation method

int indentation()

Calculates the length of indentation a String has.

Implementation

// The behavior of tabs: https://spec.commonmark.org/0.30/#tabs
int indentation() {
  var length = 0;
  for (final char in codeUnits) {
    if (char != $space && char != $tab) {
      break;
    }
    length += char == $tab ? 4 - (length % 4) : 1;
  }
  return length;
}