Skip to content

flutter_branch_sdk does not support synchronous deep link access for router integration (e.g. GoRouter) #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
developer-nesamani opened this issue May 22, 2025 · 3 comments

Comments

@developer-nesamani
Copy link

Describe the bug
When using flutter_branch_sdk in a Flutter app with routers like GoRouter, the SDK provides deep link data only via an asynchronous stream (initSession()).

This causes integration issues where the Flutter router processes the system deep link URI immediately (on cold start or resume from background), before the Branch SDK has provided the actual deep link data.

If the URI does not match any defined route, the app navigates to a fallback/error route or logs a "no route found" warning.

This is not a crash, but a routing behavior issue caused by the lack of a synchronous (or Future) API in the SDK.

To Reproduce
Steps to reproduce the behavior:

  1. Open the app once and put it in background
  2. From mail or WhatsApp, click a Branch deep link (e.g., https://myapp.app.link/promo-123)
  3. App resumes
  4. GoRouter sees URI: /promo-123 before app logic runs
  5. If route doesn't exist, fallback/error route is triggered

Expected behavior
The app should be able to await deep link data from the Branch SDK before passing it to the router. This requires a Future<Uri?> getInitialDeepLink() or similar synchronous method.

That would allow developers to delay MaterialApp.router or GoRouter initialization until the deep link is available and validated.

Mobile:

  • Flutter: version: 3.29.3
  • flutter_branch_sdk version: 8.4.0
  • OS: Android 14
  • Device: Pixel 6 Pro

Additional context
This is not a bug in GoRouter. GoRouter works as intended — it routes based on the app’s initial URI or resumed URI. The issue is that flutter_branch_sdk provides deep link data only via a stream, too late for router configuration. Firebase Dynamic Links supports this via a getInitialLink() method — a similar API in Branch would greatly improve compatibility with Flutter routing frameworks.

@developer-nesamani developer-nesamani added the bug Something isn't working label May 22, 2025
@RodrigoSMarques RodrigoSMarques removed the bug Something isn't working label May 22, 2025
@RodrigoSMarques
Copy link
Owner

Have you checked the documentation for the methods:

@developer-nesamani
Copy link
Author

Thanks for the update. I checked it, and the issue still persists.

The problem seems to happen when the app is in background mode. When a dynamic link is clicked, the navigation system receives the URL first and tries to load the corresponding named route immediately. Only after that, the listenDynamicLinks logic kicks in and processes the data, which causes a mismatch or delay in navigation.

@RodrigoSMarques
Copy link
Owner

RodrigoSMarques commented May 23, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants