skipRemainingItems method
Skips the remaining items in the collection.
This is useful when the Decodable implementation is not interested in the remaining items. It must be called when nextItem is not used exhaustively.
Implementation
@override
void skipRemainingItems() {
var level = 1;
var i = _offset;
while (true) {
switch (buffer[i++]) {
case tokenDoubleQuote: // If inside string, skip it
_offset = i;
_skipString();
i = _offset;
break;
case tokenLBracket: // If open symbol, increase level
level++;
break;
case tokenRBracket: // If close symbol, decrease level
level--;
// If we have returned to the original level, we're done
if (level == 0) {
_offset = i;
return;
}
break;
}
}
}