addBools method

Message addBools(
  1. BoolList array, [
  2. bool includeLength = true
])

Adds a BoolList to the message.

array : The array to add. includeLength : Whether or not to include the length of the array in the message.

Returns the message that the array was added to.

Implementation

Message addBools(BoolList array, [bool includeLength = true]) {
  if (includeLength) {
    addVarULong(array.length);
  }

  if (unwrittenBits < array.length) {
    throw InsufficientCapacityException.withArrayDetails(
        this, array.length, boolName, 1);
  }

  for (int i = 0; i < array.length; i++) {
    Converter.boolToBitFromUlongs(array[i], data, _writeBit++);
  }

  return this;
}