Shivam Singh
Shivam Singh

Reputation: 19

Flutter_webview_plugin net::err_unknown_url_scheme. error while opening external apps

Flutter_webview_plugin

But in my website there is a button which open whatsapp app and other apps

But in my webview after clicking that button it shows this error with all external app

Can you solve this this image will show the error

Upvotes: 0

Views: 3993

Answers (2)

kururu
kururu

Reputation: 100



var encoded = Uri.encodeFull("whatsapp://send?phone=+966${phone}");

await _launchWhatsapp(encoded);


_launchWhatsapp(String url){

final  url: Uri.parse(url);
}




make sure you you are using whatsapp: scheme

Upvotes: 0

Shivam Singh
Shivam Singh

Reputation: 19

use this and replace tel,mailto: and whatsapp with your external app links starting string.

` final flutterWebviewPlugin = new FlutterWebviewPlugin();

flutterWebviewPlugin.onUrlChanged.listen((String url) {
  if (url.startsWith('mailto:'))
  {

    _launchURL(url);
    flutterWebviewPlugin.stopLoading();
    flutterWebviewPlugin.reload();



  }
  else if (url.startsWith('tel:'))
  {

    _launchURL(url);
    flutterWebviewPlugin.stopLoading();
    flutterWebviewPlugin.reload();


  }else if (url.startsWith('whatsapp:') ||url.startsWith ('api.'))
  {

    _launchURL(url);
    flutterWebviewPlugin.stopLoading();
    flutterWebviewPlugin.reload();


  }`

Upvotes: 1

Related Questions