Listen to URL Changes in Custom Tabs
I am using the flutter_custom_tabs package to launch URLs in my Flutter app. However, I need to listen to URL changes in the browser opened by the custom tab. There doesn’t seem to be a built-in way to achieve this. Is there any way or work around to achieve this?
Unfortunately, flutter_custom_tabs doesn't currently provide a built-in mechanism for listening to URL changes within the Custom Tab.
To understand your specific use case, could you please elaborate on why you need to monitor URL changes within the Custom Tab?
Hi, good morning. I have a similar question, if possible. I'm currently working with a provider that, once an action is completed, redirects to a specific URL. I need to listen to those URL changes, as they include query string parameters that indicate the status of the action (e.g., approved, rejected, etc.).
I'm using the following method to handle URL changes with the webview_flutter package, but the issue is that it doesn't support biometrics:
void handleUrlChange(String url, BuildContext context) { if (_isUrlRelevant(url) && !_isHandlingNavigation) { setState(() { _isHandlingNavigation = true; }); _navigateToHomeAndRefreshCards(context); } }
bool _isUrlRelevant(String url) { return url.contains('rejected') || url.contains('approved') || url.contains('index') || url.contains('error') || url.contains('funds'); }
@fernandobka How did you solve this? were u able to listen to url changes?
@aggeloskoutanis yes, I had to implement deeplinks