bitstring_as_the_bytes function
[bitstring].length
must be a multiple of 8.
Implementation
Uint8List bitstring_as_the_bytes(String bitstring) {
if (bitstring.length % 8 != 0) {
throw Exception('bitstring.length must be a multiple of 8 in this funcion');
}
List<int> bytes = [];
for (int i=0;i<bitstring.length/8;i++) {
bytes.add(int.parse(bitstring.substring(i*8,i*8+8), radix:2));
}
return Uint8List.fromList(bytes);
}