prepareUrl static method

String prepareUrl(
  1. String? url,
  2. String? uri
)

Implementation

static String prepareUrl(String? url, String? uri) {
  if (url == null) url = "";
  if (uri == null) uri = "";

  // Ignores Url if uri itself is full URL
  if (uri.startsWith("http:")) return uri;

  if (!uri.startsWith("/")) uri = "/" + uri;
  if (url.endsWith("/")) url = url.substring(0, url.length - 1);
  return url + uri;
}