intToBits function

List<bool> intToBits(
  1. int number, {
  2. int bitLength = 32,
})

Implementation

List<bool> intToBits(int number, {int bitLength = 32}) {
  List<bool> bools = [];
  for (int i = bitLength - 1; i >= 0; i--) {
    bool bit = (number >> i) & 1 == 1;
    bools.add(bit);
  }
  return bools;
}