toMd5 method

String toMd5()

Computes the MD5 hash of the string and returns it as a hexadecimal String.

This method converts the string to bytes using UTF-8 encoding, then computes the MD5 hash and returns the hash as a hexadecimal string.

Returns a String representing the MD5 hash of the original string.

Implementation

String toMd5() {
  List<int> bytes = utf8.encode(this);
  Digest md5Result = md5.convert(bytes);
  String md5String = md5Result.toString();
  return md5String;
}