toggleBit method

ByteConverter toggleBit(
  1. int index
)

Returns a new ByteConverter with the bit at index toggled.

Implementation

ByteConverter toggleBit(int index) {
  if (index < 0 || index >= 64) {
    throw RangeError.range(index, 0, 63, 'index');
  }
  final newBits = _converter.bits ^ (1 << index);
  return ByteConverter.withBits(newBits);
}