u64BytesHelper method

Uint8List u64BytesHelper(
  1. int x
)

Implementation

Uint8List u64BytesHelper(int x) {
  if (x.isInfinite) throw FormatException("Cannot process Infinite number");
  String radixString = x.toRadixString(2);
  while (radixString.length < 64) {
    radixString = '0' + radixString;
  }
  List<int> bytes = [];
  for (int i = 0; i < 8; i++) {
    bytes.add(int.parse(radixString.substring(i * 8, i * 8 + 8), radix: 2));
  }
  return Uint8List.fromList(bytes);
}