convertView method

Uint8List convertView(
  1. Object? value
)

value as JSON bytes, with no copy: the result is a part of the buffer of this encoder. The buffer is then lent to the caller.

While the buffer is lent, every other call of this encoder writes into a new buffer, so it can not change the lent bytes. Give the buffer back with giveBack when the bytes are copied. A buffer that is never given back only makes the next calls slower.

Implementation

Uint8List convertView(Object? value) {
  if (_busy || _lent != null) return _fresh().convert(value);
  Uint8List view = _encode(value);
  _lent = view;
  return view;
}