fromAscii function

String fromAscii(
  1. String stringValue
)

Should be called to get hex representation (prefixed by 0x) of ascii string

Implementation

String fromAscii(String stringValue) {
  var hexString = ''; // eslint-disable-line
  for (var i = 0; i < stringValue.length; i++) {
    // eslint-disable-line
    var code = stringValue.codeUnitAt(i);
    var n = hex.encode([code]);
    hexString += n.length < 2 ? "0$n" : n;
  }

  return "0x$hexString";
}