Bytes.fromHex constructor

Bytes.fromHex(
  1. String hex
)

Implementation

factory Bytes.fromHex(String hex) {
  if (hex.startsWith(bytesPrefix)) {
    return Bytes(
      const HexDecoder().convert(hex.replaceFirst(bytesPrefix, '')),
    );
  }
  return Bytes(const HexDecoder().convert(hex));
}