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

I am using the url_launcher package to open a login URL in an external browser. I need to listen to URL

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745248594a4618536.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信