flutter_web_browser icon indicating copy to clipboard operation
flutter_web_browser copied to clipboard

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

Open karansingla007 opened this issue 3 years ago • 4 comments

@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.

karansingla007 avatar Feb 11 '22 05:02 karansingla007

@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?

madilsharief avatar Feb 22 '22 04:02 madilsharief

Bump

renanmgs avatar Mar 02 '22 14:03 renanmgs

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();
      }
    });

srinivasupadhya avatar May 16 '22 05:05 srinivasupadhya

@srinivasupadhya The RedirectEvent happens only once when the initial URL passed is opened but not for subsequent navigations.

SlickSlime avatar Jul 16 '24 10:07 SlickSlime