peekChar method
- 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]) {
offset ??= 0;
final index = position + offset;
if (index < 0 || index >= string.length) return null;
return string.codeUnitAt(index);
}