llfbandit / app_links

Android App Links, Deep Links, iOs Universal Links and Custom URL schemes handler for Flutter.
https://pub.dev/packages/app_links
Apache License 2.0
176 stars 68 forks source link

[Bug] hot reload calls deeplink again #61

Closed mkbsugita closed 9 months ago

mkbsugita commented 1 year ago

Describe the bug

A clear and concise description of what the bug is.

final appLink = await _appLinks.getInitialAppLink();

_linkSubscription = _appLinks.uriLinkStream.listen((uri) {
  myMethod(context, url: appLink ?? uri);
});

when I did hot reload it calls deep link again!!!

Does it related to

[ ] App Links (Android)
[ ] Deep Links (Android)
[o] Universal Links (iOS)
[ ] or Custom URL schemes? (iOS)

Does the example project work?

[o] Yes
[ ] No
[ ] Irrelevant here

Did you fully read the instructions for the targeted platform before submitting this issue?

Uploaded your files to webserver, HTTPS, direct connection, scheme pattern setup, ...

[ ] Yes
[o] No
[ ] Irrelevant here

pro100svitlo commented 10 months ago

yep, indeed.

Even worse:

llfbandit commented 9 months ago

Need to move away initialLink & latestLink to dart code. A thing to note here, we can't listen to hot restarts because the app is destroyed and re-created.

llfbandit commented 9 months ago

I digged into the code tonight and there's nothing I can do for this. Plugins are not aware of hot reloads or restarts and I must keep initial link on native side to ensure that it will not be skipped at launch from cold state.

Notice that this is not a specific issue on iOS platform, the same happens on Android too. Anyway, this can occur only on debug sessions.

EM-Sabeel commented 4 months ago

I also have the same issue. Is there any fix? Not only the debug mode I faced in release mode. Above comment, @llfbandit mentioned a solution but it is not working anymore.

Need to move away initialLink & latestLink to dart code. let me know if any other fixes.

EM-Sabeel commented 4 months ago

can you provide a reset option to reset the URI? it will be helpful.

SL-Chinmay commented 4 months ago

I am also getting the same issue still. Is there any fix or workaround for this bug? The app never stops executing getInitialAppLink() when doing hot restarts.

xdanaskos commented 2 months ago

Hello all,

I am having the same issue but not only with hot restarts. My issue is that I navigate through the app and then I navigate back to the statefull widget that does the call. Then the getInitialAppLinkis excecuted again and I end up navigating to the same loop.