peekChar method

int peekChar ([int offset ])

Returns the character code of the character offset away from position.

offset defaults to zero, and may be negative to inspect already-consumed characters.

This returns null if offset points outside the string. It doesn't affect lastMatch.

Implementation

int peekChar([int offset]) {
  if (offset == null) offset = 0;
  var index = position + offset;
  if (index < 0 || index >= string.length) return null;
  return string.codeUnitAt(index);
}