appImageCorrectUrl method

String appImageCorrectUrl(
  1. String url, {
  2. dynamic base,
})

Implementation

String appImageCorrectUrl(String url, {base}) {
  if (url.trim().indexOf('http') != 0) {
    if ((base ?? baseUrlAsset ?? '').endsWith('/')) {
      if (url.startsWith('/')) {
        return (base ?? baseUrlAsset ?? '') + url.substring(1);
      } else {
        return (base ?? baseUrlAsset ?? '') + url;
      }
    } else {
      if (url.startsWith('/')) {
        return (base ?? baseUrlAsset ?? '') + url;
      } else {
        return (base ?? baseUrlAsset ?? '') + '/' + url;
      }
    }
  }
  return url;
}