hexStringToBytes static method
Implementation
static Uint8List hexStringToBytes(String hex) {
// Delete blank space
hex = hex.splitMapJoin(" ", onMatch: (Match match) {
return "";
});
if (hex.length % 2 != 0) {
throw "Hex string length must be even integer, got ${hex.length}";
}
var result = <int>[];
for (int i = 0; i < hex.length; i += 2) {
result.add(int.parse(hex.substring(i, i + 2), radix: 16));
}
return Uint8List.fromList(result);
}