victorbonnet / flutter_web_browser

Plugin for flutter to open web page with Chrome Custom Tabs and SFSafariViewController
MIT License
62 stars 39 forks source link

How can I listen the changes in url and take action on that. #44

Open karansingla007 opened 2 years ago

karansingla007 commented 2 years ago

@victorbonnet I am using flutter_web_browser: ^0.16.0 with flutter version 2.8.1 and I want to listen to the URL and perform some actions.

madilsharief commented 2 years ago

@victorbonnet I am using flutter_web_browser: ^0.16.0 with flutter version 2.8.1 and I want to listen to the URL and perform some actions.

Same question! It appears that it's only supporting close events that's it. Won't catch any redirect event at all. Please update?

renanmgs commented 2 years ago

Bump

srinivasupadhya commented 2 years ago

Not sure why this isn't documented. But here is the sample code for it. Note: works only on iOS

    FlutterWebBrowser.events().listen((event) {
      if (event is RedirectEvent) {
        onRedirect(event.url);
      }
      if (event is CloseEvent) {
        onClose();
      }
    });