add method

  1. @override
int add(
  1. List<int> data,
  2. int offset
)
override

Implementation

@override
int add(List<int> data, int offset) {
  while (data[offset] <= tokenSpace && offset < data.length) {
    offset++;
  }
  if (offset >= data.length) {
    return offset; // No more bytes to process.
  }
  final byte = data[offset];
  final next = switch (byte) {
    tokenDoubleQuote => DecodingType.string,
    tokenT || tokenF => DecodingType.bool,
    tokenN => DecodingType.nil,
    tokenLBrace => DecodingType.keyed,
    tokenLBracket => DecodingType.iterated,
    _ => DecodingType.num,
  };
  _onNext(next);
  close();
  return offset; // Return the current offset, which is the next byte to process.
}