hexstringasthebytes function
Implementation
Uint8List hexstringasthebytes(String hex) {
List<int> bytes = [];
if (hex.substring(0,2)=='0x' || hex.substring(0,2)=='\\x') {
hex = hex.substring(2);
}
if (hex.length % 2 != 0) {
throw Exception('hex string must be divisable by 2');
}
for (int i=0;i<hex.length/2;i++) {
bytes.add(int.parse(hex.substring(i*2,i*2+2), radix: 16));
}
return Uint8List.fromList(bytes);
}