asBools static method

List<bool?> asBools(
  1. int? val,
  2. int bits
)

Implementation

static List<bool?> asBools(int? val, int bits) {
  var list = List<bool?>.filled(bits, null, growable: false);

  var mask = 1 << (bits - 1);
  for (var i = 0; i < bits; i++, mask >>= 1) {
    list[i] = val! & mask != 0;
  }
  return list.reversed.toList();
}