bytesToHex function
Implementation
String bytesToHex(List<int> bytes,
{bool include0x = false,
int? forcePadLength,
bool padToEvenLength = false}) {
var encoded = hex.encode(bytes);
if (forcePadLength != null) {
assert(forcePadLength >= encoded.length);
final padding = forcePadLength - encoded.length;
encoded = ('0' * padding) + encoded;
}
if (padToEvenLength && encoded.length % 2 != 0) {
encoded = '0$encoded';
}
return (include0x ? '0x' : '') + encoded;
}