getGmailProfileUrl static method

String getGmailProfileUrl(
  1. String photoUrl,
  2. int height,
  3. int width
)

Get the Gmail profile URL with configurable height and width

You need to get the photoUrl for the original photo. This function change the URL to get the image with fixed size.

Implementation

static String getGmailProfileUrl(
  String photoUrl,
  int height,
  int width,
) {
  String res = "";
  for (int c in photoUrl.runes) {
    var char = String.fromCharCode(c);
    res += char;
    if (char == '=') {
      res += 'h' + height.toString();
      res += '-w' + width.toString();
      break;
    }
  }
  return res;
}