Want to open app links in flutter webview? You can use webview_flutter in pub.dev Packages.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | WebView( initialUrl: 'https://my.url.com', javascriptMode: JavascriptMode.unrestricted, navigationDelegate: (NavigationRequest request) { if (request.url.startsWith('https://my.redirect.url.com')) { print('blocking navigation to $request}'); _launchURL('https://my.redirect.url.com'); return NavigationDecision.prevent; } print('allowing navigation to $request'); return NavigationDecision.navigate; }, ) |
And you can launch url with url_launcher in pub.dev Packages
1 2 3 4 5 6 | _launchURL(String url) async { if (await canLaunch(url)) { await launch(url); } else { throw 'Could not launch $url'; }} |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.