readBytes method

List<int> readBytes({
  1. bool copy = true,
  2. bool reset = false,
  3. bool hard = false,
})

Return the read contents of the buffer as a List.

This will include the data in the buffer from the start up to the read amount. If copy is true, then a copy of the bytes will be returned, otherwise a view of the bytes is returned (which may change since this is buffered) If reset is true, the readCount will be set to 0. If hard is true, the _recordedReadCount will also be set to 0.

Implementation

List<int> readBytes(
    {bool copy = true, bool reset = false, bool hard = false}) {
  final listView = baseListView(readCount);
  final list = (copy == true) ? Uint8List.fromList(listView) : listView;
  if (reset == true) resetRead(hard: hard);
  return list;
}