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() {
  final digest = MD5Digest();
  final bytes = utf8.encode(this);
  final hash = digest.process(Uint8List.fromList(bytes));
  return hash.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join();
}