getGravatarUrl method
Generates a Gravatar URL for the given email address.
Creates an MD5 hash of the email (trimmed and lowercased) and constructs a Gravatar URL with an identicon fallback for emails without associated avatars.
Parameters:
email: The email address to generate the Gravatar URL for
Returns a string URL pointing to the Gravatar image, e.g.:
https://www.gravatar.com/avatar/{hash}.jpg?d=identicon
Example:
final avatarUrl = RtCommonFunction.instance.getGravatarUrl('user@example.com');
// Returns: https://www.gravatar.com/avatar/{md5_hash}.jpg?d=identicon
Implementation
String getGravatarUrl(String email) {
final emailHash =
md5.convert(utf8.encode(email.trim().toLowerCase())).toString();
return "https://www.gravatar.com/avatar/$emailHash.jpg?d=identicon";
}