Ad

How To Open A Link To Call Or Mail (tel: And Mailto:) In Flutter. Using Flutter_webview_plugin

I am creating a webview app using flutter_webview_plugin. I am stack at allowing the app to launch phone call and mailto links. When I use webview_flutter I get the bottom menus and the address bar at the top does not disappear

Ad

Answer

I have managed to come up with this simple solution, just add these few lines of code in your initState, you can add 'mailto:' and 'sms' if necessary.

final flutterWebviewPlugin = new FlutterWebviewPlugin();
flutterWebviewPlugin.onUrlChanged.listen((String url) {
  if (url.contains("tel:")) launch(url);
});
Ad
source: stackoverflow.com
Ad