launchURLInWebViewOrBrowser static method
- BuildContext context,
- String url, {
- LaunchMode? mode,
Launches the URL in a WebView if it's an OFF link or an external browser.
Implementation
static Future<void> launchURLInWebViewOrBrowser(
BuildContext context,
String url, {
LaunchMode? mode,
}) async {
if (url.startsWith(
RegExp(
r'http(s)?://[a-z\-]*.open(food|beauty|products|petfood)facts.(net|org)',
),
)) {
AppNavigator.of(context).push(AppRoutes.EXTERNAL_WEBVIEW(url));
} else {
return launchURL(url, mode: mode);
}
}