getUrlForImage method

String getUrlForImage(
  1. String? url,
  2. RESOLUTION_TYPE? resolution,
  3. SERVICE_TYPE? service_type, {
  4. bool shouldprint = false,
  5. required String urlWithoutHttp,
})

Implementation

String getUrlForImage(
    String? url, RESOLUTION_TYPE? resolution, SERVICE_TYPE? service_type,
    {bool shouldprint = false, required String urlWithoutHttp}) {
  String? imageName;
  if (url != null) {
    var s = url.split('/');
    imageName = s[s.length - 1];
  }
  var queryParameters = {
    'name': imageName,
    'resolution': resolution.type,
    'service_type': service_type.type
  };
  var uri =
      Uri.https(urlWithoutHttp, '/api/v1/file/media/read', queryParameters)
          .toString();
  return uri;
}