readBytes method

  1. @protected
Future<List<int>> readBytes(
  1. int size
)
inherited

Read size bytes or throw RangeError if there's not enough data available from the data.

Implementation

@protected
Future<List<int>> readBytes(int size) async {
  final bytes = await data.readChunk(size);
  if (bytes.length != size)
    throw ByteReaderException('stream has fewer bytes than expected. Size: ${bytes.length}, expected: $size.');

  return bytes;
}