read method

  1. @override
  2. @pragma('vm:prefer-inline')
List<int> read(
  1. BufferContext bc,
  2. int offset
)
override

Read the value at the given offset in bc.

Implementation

@override
@pragma('vm:prefer-inline')
List<int> read(BufferContext bc, int offset) {
  final listOffset = bc.derefObject(offset);
  final length = bc._getUint32(listOffset);

  if (lazy) return bc._asUint8List(listOffset + _sizeofUint32, length);

  final result = Uint8List(length);
  var pos = listOffset + _sizeofUint32;
  for (var i = 0; i < length; i++, pos++) {
    result[i] = bc._getUint8(pos);
  }
  return result;
}