decode static method

Uint8List decode(
  1. String hex
)

Implementation

static Uint8List decode(String hex) {
  String str = trimHex(hex);
  if (str.length % 2 != 0) {
    str = "0" + str;
  }

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