lukepighetti / fluro

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.
https://pub.dev/packages/fluro
MIT License
3.67k stars 417 forks source link

replace: true issue #203

Closed Akiat closed 3 years ago

Akiat commented 3 years ago

First of all thank you very much for this great router :)

I need to replace a page and I tried to use router.navigateTo(context, "/", replace: true, clearStack: true); without success.

The navigation works, but the replacement doesn't. In the flutter inspector, I see the stack page increasing each time I use the router with replace: true.

I don't think this is related to my workflow because with Navigator.pushReplacementNamed(context, '/'); it works perfectly.

I didn't find documentation about replace and clearStack properties, so maybe I'm just wrong, and if it's the case, what is the solution to replace a page ?

Thanks for your help :)

lukepighetti commented 3 years ago

We use Navigator.pushReplacement under the hood. Can you think of anything that might be stopping control flow getting to pushReplacement on line 94?

https://github.com/lukepighetti/fluro/blob/master/lib/src/fluro_router.dart#L93-L95

Akiat commented 3 years ago

It's really weird in fact. At the moment, the only thing that I use which manages itself the routes (only for the splashscreen) is the flutter package splashscreen. And my navigateTo point to this spashscreen (ThenavigateTo is in the retry_loading page displayed if the loading of my external data during the spashscreen doesn't worked). So maybe it could be this ...

But don't spend too much time on my issue, I think it's related to my project cause I don't see any reason your code will not works. And it works well with the pushReplacement directly.

Thanks a lot for your time anyway :)

lukepighetti commented 3 years ago

No problem! Closing because there is nothing actionable.