hexToBytes static method
Converts a hexadecimal string to a byte array. The hexadecimal digit symbols are case-insensitive.
@param hex a string containing hex digits @return an array of bytes with the value of the hex string
Implementation
static List<int> hexToBytes(String hex) {
List<int> bytes = HEX.decode(hex);
return bytes;
//
// int byteLen = hex.length ~/ 2;
// List<int> bytes = List(byteLen);
//
// for (int i = 0; i < byteLen; i++) {
// int i2 = 2 * i;
// if (i2 + 1 > hex.length)
// throw ArgumentError("Hex string has odd length");
//
// int nib1 = hexToInt(hex.charAt(i2));
// int nib0 = hexToInt(hex.charAt(i2 + 1));
// int b = (nib1 << 4) + nib0;
// bytes[i] = b;
// }
// return bytes;
}