csells/go_router

Reusing screens

Closed this issue · 3 comments

Is there a more elegant way to have the same screen reachable from different locations than defining the same GoRoute & builder multiple times with different paths?

I didn't get what do you mean @Lootwig. Please give an example.
I reach the same screen from different locations using: context.pushNamed('screen_a') or context.pushNamed('screen_b', params: {'id': 'product_id'})

Is the location parameter of the GoRoute ignored in that case? If so, why is it a mandatory parameter in the first place?

Did you mean path parameter? It's is still used under the hood (and in the browser bar). Named location just searches for it.
When you are on /home/page, you can do context.push('/my/totally/random/location') (or pushNamed('somewhere')) and it will work just fine.