writeBytes method Null safety
Writes a byte array to the stream of length bytes
and bits
Implementation
void writeBytes(Uint8List input, {int bytes = 0, int bits = 0}) {
var len = (bytes * 8) + bits;
var totBytes = len ~/ 8;
var remBits = len % 8;
var numBytes = input.lengthInBytes;
if (remBits > 0) {
var firstByte = (numBytes - totBytes) - 1;
write(input[firstByte], bits: remBits);
}
for (var x = numBytes - totBytes; x < numBytes; x++) {
write(input[x], bytes: 1);
}
}