openLink static method
Implementation
static Future<bool> openLink(
String link, {
String? href,
String title = "",
bool preferNonBrowserApp = false,
}) async {
try {
String urlString = GetUtils.isURL(link) ? link : (href ?? "");
if (!urlString.contains("https://") && !urlString.contains("http://")) {
urlString = "https://$urlString";
}
Uri url = Uri.parse(urlString);
return await launchUrl(
url,
mode: preferNonBrowserApp
? LaunchMode.externalNonBrowserApplication
: LaunchMode.externalApplication,
);
} catch (e) {
return false;
}
}