Kęstas Venslauskas
Kęstas Venslauskas

Reputation: 401

Flutter go_router deep link behaviour

I do have initial implementation with deeplinks handling in my app with go_router

my problem:

If I already have a stack with few screens and I open deeplink it will clear my stack and open that screen only. Meaning it pops all previous screens.

Expectation - open a deeplink on top of my stack simply pushing new route.

Any ideas?

Can a deep link update just screen navigation properties - like a callback?

If I could also handle deeplinks without navigation like a global callback also would be ok.

The feature is payments - which happens on browser. And I need to navigate user back to the app on the payment screen where he was before.

Upvotes: 1

Views: 1079

Answers (1)

Cyrille Dakhlia
Cyrille Dakhlia

Reputation: 407

You have to make sure your routes are well configured to have the expected behaviour you are aiming for.

I don't know which underlying navigation method deep-links use, but if it's something like push, it will always add the new page on top of your navigation stack, whereas if it's something like go from the go_router package, it will modify the navigation stack if the new route is not a sub-route of the old one.

You can find an example of this behaviour on this post.

Otherwise you have some relevant information of the topic (push vs go with some mentions of deep linking) in this good article.

Upvotes: 1

Related Questions