# parseHexToBytes static method

Uint8List parseHexToBytes(

1. String hex

)

Convert Hex String to Uint8List

## Implementation

    static Uint8List parseHexToBytes(String hex) {
      if (hex.length % 2 != 0) {
        throw ArgumentError('Invalid hex string');
      }
      if (hex.startsWith('0x')) {
        hex = hex.substring(2);
      }

      var bytes = Uint8List(hex.length ~/ 2);
      for (var i = 0; i < hex.length; i += 2) {
        bytes[i ~/ 2] = int.parse(hex.substring(i, i + 2), radix: 16);
      }
      return bytes;
    }