fromUtf8 function

String fromUtf8(
  1. String stringValue
)

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

Implementation

String fromUtf8(String stringValue) {
  ArgumentError.checkNotNull(stringValue);

  var stringBuffer = utf8.encode(stringValue);

  return "0x${padToEven(hex.encode(stringBuffer)).replaceAll(RegExp('^0+|0+\$'), '')}";
}