master_detail_scaffold
master_detail_scaffold copied to clipboard
using subroutes as initialroute is not working
Hi,
we are using this package and it is really helpful! Thank you.
We encountered that it doesn't work with subroutes. So if the initialRoute is not "/". Are we missing something? I modified the example on my fork to show you what i mean.
The error is: Globalkey is used multiple times.
Fork: https://github.com/winwisely104/master_detail_scaffold
Lots of our modules rely on sub routes to work with flutter web because it allows users to copy links but also for deeplinks to work.
We are using flutter channel 'beta'
I won't have a chance to run your fork until perhaps later in the week. One thing that looks odd that may be related to your issue is that I see you're defining home as a route for both the top-level navigator (i.e. the one associated with the MaterialApp) and the navigator used by the details pane (see docs for the initialRoute property). I believe this means getting to the initial route for the master detail scaffold would require the URL to be something like /home/home
Having said that your issue seems to relate to a limitation that I describe in the readme that I quote below for convenience
Note that I've found that entering a URL that should go to a specific details page doesn't work. This is likely due to the fact that Flutter's web support for web development isn't stable yet. Should you find a solution for this, please submit a pull request.
@MaikuB thankyou for looking at our code and pointing out our bug
Hi @MaikuB thank you for your quick answer! I was talking about the initialRoute of the MasterDetailScaffold, not of the MaterialApp. In the example MaterialApp's initialRoute is "/". Then I navigate (via a button) to "/home" where the MasterDetailScaffold is. MasterDetailsScaffold's initialRoute is now "/home" and this throws an exception. Your example is working if I change the MasterDetailScaffold's initialRoute also to "/". But then i have the flutter web problem you mentioned. If we have an idea I will let you know. If I am missing sth please let me know... :) Thanks
@winwisely99 , @winwisely104 Did you manage to figure out how to solve this issue?