bytesToHex function
Legacy bytesToHex compatibility
Implementation
String bytesToHex(
List<int> bytes, {
bool include0x = false,
int? forcePadLength,
bool padToEven = false,
}) {
var encoded = HexUtils.encode(Uint8List.fromList(bytes));
if (encoded.startsWith('0x')) encoded = encoded.substring(2);
if (padToEven && encoded.length % 2 != 0) encoded = '0$encoded';
if (forcePadLength != null) encoded = encoded.padLeft(forcePadLength, '0');
return include0x ? '0x$encoded' : encoded;
}