readBytes method
Get the bytes from the current index to the length
Example:
final input = Input.fromHex('0x010203');
print(input.readBytes(3)); // [1, 2, 3]
Implementation
@override
Uint8List readBytes(int length) {
final int beg = offset;
final int end = offset + length;
if (end > _buffer.length) {
throw Exception('End of buffer reached');
}
offset = end; // Update the index
return Uint8List.fromList(
_buffer.sublist(beg, end).toList()); // Extract the required bytes
}