nextAll method
Consume and answer a List containing up to the next amount
of
consecutive bytes.
If upToAmount
is true
, then read as many bytes up to amount
, which
can be limited by the number of bytes written.
Implementation
List<int> nextAll(int amount, {bool upToAmount = false}) {
var endOffset = readCount + amount;
if (upToAmount != true) {
endOffset = RangeError.checkValidRange(readCount, endOffset, writeCount);
}
final readAmount = min(endOffset - readCount, unreadCount);
final result = readListView(readAmount);
incrementBytesRead(readAmount);
return result.toList(growable: false);
}