isValidProxyUrl function

bool isValidProxyUrl(
  1. String url
)

Validates that the proxy URL is well-formed.

Implementation

bool isValidProxyUrl(String url) {
  try {
    final uri = Uri.parse(url);
    return uri.hasScheme &&
        (uri.scheme == 'http' || uri.scheme == 'https') &&
        uri.host.isNotEmpty;
  } catch (_) {
    return false;
  }
}