Checks if a string is a valid URL.
bool isValidUrl(String url) { try { Uri.parse(url); return true; } catch (_) { return false; } }