I am developing WebApp in Flutter but when I click on tel:987654321
or mailto:
links going page Not Found,
To open the default app in mobile I am u
navigationDelegate: (NavigationRequest request) {
if(request.url.contains("mailto:")) {
launch(request.url);
return NavigationDecision.prevent;
}
else if (request.url.contains("tel:")) {
launch(request.url);
return NavigationDecision.prevent;
}
},
Add some details, need url_launcher
plugin
import 'package:webview_flutter/webview_flutter.dart';
import 'package:url_launcher/url_launcher.dart';
_launchURL(url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
in Widget-build ...
WebView(
initialUrl: 'http://example.com',
navigationDelegate: (NavigationRequest request) {
if (request.url.contains("mailto:")) {
_launchURL(request.url);
return NavigationDecision.prevent;
} else if (request.url.contains("tel:")) {
_launchURL(request.url);
return NavigationDecision.prevent;
}
return NavigationDecision.navigate;
},
)