flipBit method

void flipBit(
  1. int position
)

Implementation

void flipBit(int position) {
  if (position > _length) {
    throw Exception('requested position is out of range');
  }
  var posInData = position ~/ 8;
  var posInByte = position % 8;
  var mask = pow(2, 7 - posInByte).toInt();

  _data[posInData] ^= mask;
}