skip to Main Content

I implemented go_router to use deep links in my app, but for some paths, I need to ignore the deep link and open them in the browser.

For example, when the user clicks the following URL https://example.com/login, the deep link works fine and opens my Flutter app on the specific page.

However, when the user clicks on https://example.com/privacy, I need this link to open in the default browser and not in my app.

I’ve been searching for a solution, but the result is always the same: the link always opens in my app.

I tried using the launchUrl package, but the result is still the same:

launchUrl(Uri, mode: LaunchMode.externalApplication);

I’ve tried all the available LaunchMode options, but nothing seems to work.

I need open some paths in browser app and others in my app.

The paths are some examples, I need all the paths that are not specifying in the route map go to the web page

I implemented go_router library

2

Answers


  1. It would be helpful for you to post your apple-app-site-association and/or your assetlinks.json as well as discuss which platform you are using.

    Regarding deep links in Flutter there are important differences with Android and iOS to understand. Apple provides the ability to exclude certain paths via support in their apple-app-site-association. More info can be seen on their docs with an example on how to exclude.

    In Android 12, changes were made that impact the ability for a developer to route a url to the external browser aka the web. If you have declared that your Android App Links to accept /privacy then Android will always route the user back to your application.

    You will either need to handle this route in your application or do not declare the route of /privacy in your asset-links file for Android.

    Login or Signup to reply.
  2. This work for me using url_launcher as follow:

      launchURL("https://example.com/privacy",mode:LaunchMode.inAppWebView );
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search