bytesToHex function
Converts the bytes
given as a list of integers into a hexadecimal
representation.
If any of the bytes is outside of the range 0, 256
, the method will throw.
The outcome of this function will prefix a 0 if it would otherwise not be
of even length. If include0x
is set, it will prefix "0x" to the hexadecimal
representation.
Implementation
String bytesToHex(List<int> bytes, {bool include0x = false}) {
return (include0x ? '0x' : '') + hex.encode(bytes);
}