canLaunch static method
Checks if a URL can be launched without actually launching it.
url The URL to check
Returns true if the URL can be launched, false otherwise.
Implementation
static Future<bool> canLaunch(String? url) async {
if (!isValidUrl(url)) {
return false;
}
try {
final Uri? uri = Uri.tryParse(url ?? '');
if (uri == null) return false;
return await canLaunchUrl(uri);
} catch (e, stackTrace) {
safeDebugLog(
'Exception occurred while checking if URL can be launched: $url - $e',
stackTrace: stackTrace,
);
return false;
}
}