bytesFromHex function

Uint8List bytesFromHex(
  1. String hexData, {
  2. bool pad = false,
})

Implementation

Uint8List bytesFromHex(String hexData, {bool pad = false}) {
  assert(hexData.length % 2 == 0, "hex data: $hexData = ${hexData.length}");
  return pad
      ? Uint8List.fromList(hex.decode(hexData)).padLeft(hexData.length ~/ 2, 0)
      : Uint8List.fromList(hex.decode(hexData));
}