withScheme function

String withScheme(
  1. String url
)

Prefixes url with https:// when it has no scheme.

Implementation

String withScheme(String url) {
  if (url.startsWith("http://") || url.startsWith("https://")) return url;
  return "https://$url"; // Default to HTTPS if no scheme is provided
}