convertBoolArrayToByteArray static method

Uint8List convertBoolArrayToByteArray(
  1. List<bool> boolArr
)

Packs a bit array into bytes, most significant bit first

Implementation

static Uint8List convertBoolArrayToByteArray(List<bool> boolArr) {
  final Uint8List byteArr = Uint8List((boolArr.length + 7) ~/ 8);
  for (int i = 0; i < byteArr.length; i++) {
    byteArr[i] = _readByte(boolArr, 8 * i);
  }
  return byteArr;
}