toByteList method

List<int> toByteList(
  1. bool lsbFirst,
  2. int len
)

Implementation

List<int> toByteList(bool lsbFirst, int len) {
  List<int> out = List(len);
  if (lsbFirst) {
    for (int i = 0; i < len; i++) {
      out[i] = (this >> (i * 8)) & 0xFF;
    }
  } else {
    for (int i = 0; i < len; i++) {
      out[len - 1 - i] = (this >> (i * 8)) & 0xFF;
    }
  }
  return out;
}