toBinaryBool static method

List<bool> toBinaryBool(
  1. BigInt value, {
  2. int? bitLength,
})

Implementation

static List<bool> toBinaryBool(BigInt value, {int? bitLength}) {
  bitLength ??= bitlengthInBytes(value) * 8;
  // Make sure we have exactly 64 bits
  final bits = List<bool>.filled(bitLength, false);

  for (int i = 0; i < bitLength; i++) {
    // Check if the i-th bit is set
    bits[i] = value & (BigInt.one << i) != BigInt.zero;
  }
  return bits;
}