compressImageUrl method

String compressImageUrl(
  1. String url
)

Implementation

String compressImageUrl(String url) {
  try {
    if (url.startsWith('http')) {
      if (url.endsWith('!user')) url = url.replaceAll('!user', '');
    }
    var spacing = url.contains('?') ? '&' : '?';
    return '$url${spacing}x-oss-process=image/resize,w_200';
  } catch (e) {}
  return url;
}