ByteArray.fromHex constructor

ByteArray.fromHex(
  1. String hexString
)

Decode hexString to ByteArray.

Example:

ByteArray.fromHex('0x0102030a').toList(); // [1,2,3,10]
ByteArray.fromHex('0a0b0102').toList(); // [10,11,1,2]
ByteArray.fromHex('000f010a').toList(); // [0,15,1,10]
ByteArray.fromHex('F0102').toList(); // [15,1,2]

Implementation

factory ByteArray.fromHex(String hexString) =>
    ByteArray(hexDecode(hexString));