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
Object? nextKey() {
if (_parent._offset >= _parent.buffer.length) {
return null;
}
_key++;
if (_key >= _parent.keys.length) {
if (_parent.buffer[_parent._offset] != tokenLineFeed) {
throw CodableException.unexpectedType(expected: 'end of line', data: _parent.buffer, offset: _parent._offset);
}
return null;
}
if (_key > 0) {
if (_parent.buffer[_parent._offset] != tokenComma) {
throw CodableException.unexpectedType(expected: ',', data: _parent.buffer, offset: _parent._offset);
}
_parent._offset++;
}
return _parent.keys[_key];
}