decodeHex function

Uint8List decodeHex(
  1. String value
)

Decodes hex value and converts to Buffer of Uint8List

Implementation

Uint8List decodeHex(String value) {
  if (value.startsWith('0x')) {
    value = value.substring(2);
  }
  try {
    return Uint8List.fromList(hex.decode(value));
  } catch (_) {
    throw HexException(value);
  }
}