nextRawBytes method Null safety
- int length
Extract a sequence of bytes from the range.
The length
number of bytes are copied from the beginning of the range
and returned. Those bytes are then no longer a part of the range.
Throws a BadEncoding if there are less than length bytes in the range, or the length is negative.
Implementation
Uint8List nextRawBytes(int length) {
if (length < 0) {
throw KeyBad('length is negative');
}
if (end < begin + length) {
throw KeyBad('data incomplete');
}
final result = bytes.sublist(begin, begin + length);
begin += length;
return result;
}