最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

flutter - Unable to Listen to URL Changes in Browser Launched with url_launcher - Stack Overflow

programmeradmin0浏览0评论

I am using the url_launcher package to open a login URL in an external browser. I need to listen to URL changes that occur in the browser after the initial launch. While I have tried using the app_links package to listen for URL changes, it only triggers when the redirect URL is hit, not for intermediate URL changes.

Current Behavior:

The url_launcher package opens the URL in an external browser but does not provide any mechanism to listen to URL changes.

The app_links package only listens for the final redirect URL and does not capture intermediate URL changes.

Expected Behavior: I would like to have a way to listen to all URL changes in the browser launched by url_launcher, not just the final redirect URL.

final appLinks = AppLinks();

_uriSubscription = appLinks.uriLinkStream.listen((uri) async {
  if (uri != null) {
    print("Received URL: ${uri.toString()}");

    if (uri.toString().startsWith(redirectUrl)) {
      // My redirect logic.
    }
  }
});

Is there any way to achieve this or please suggest alternative approaches that allow listening to URL changes while maintaining a native browser experience.

发布评论

评论列表(0)

  1. 暂无评论