nextKey method
Moves to the next key-value pair in the collection and returns the key.
Returns null
if there are no more key-value pairs to decode.
The key can be of type String or int depending on the format.
Implementation
@override
String? nextKey() {
skipWhitespace();
switch (buffer[_offset++]) {
case tokenLBrace:
case tokenComma:
skipWhitespace();
if (buffer[_offset] == tokenRBrace) {
_offset++;
return null;
}
final field = _readString();
skipWhitespace();
if (buffer[_offset++] != tokenColon) {
_expect(':', _offset - 1);
}
return field;
case tokenRBrace:
return null;
default:
_expect('{ or , or }', _offset - 1);
}
}