arrayify function
- String hexString
Converts the given hex string hexString
to its corresponding 32 bytes Uint8List representation.
hexString
: The hex string to convert.
Returns a Uint8List representing the converted bytes.
Implementation
Uint8List arrayify(String hexString) {
hexString = hexString.replaceAll(RegExp(r'\s+'), '');
List<int> bytes = [];
for (int i = 0; i < hexString.length; i += 2) {
String byteHex = hexString.substring(i, i + 2);
int byteValue = int.parse(byteHex, radix: 16);
bytes.add(byteValue);
}
return Uint8List.fromList(bytes);
}