Closed CripyIce closed 3 years ago
Hi,
actually if you want any sort of deep-linking I would go with queryParameters
, optional filtering is exactly why they are here for.
The other option is to store all this data using any state management method you want. Of course the issue here is that if you share the url you won't share your selected options.
Depends on what you want :wink:
Thanks for the fast response,
The app is personally for each user, so I don't see the reason to be able to have the option to share the url - so I guess I can pass queryParameters
for now.
You suggest using Provider
for example? Any way of keep using Navigator
with vrouter
?
Actually if it's just for a filter screen you don't have to change the url so you can use Navigator.push
and Navigator.pop
with vrouter (just be sure to have a recent version of vrouter because compatibility with Navigator
was added recently, I believe you must be >=v1.1.3
).
Please mind that this is a very simple scenario where you just have 2 screens. It can work for certain case though, especially if you are unsure of which state management method to use I think this will be enough. This can easily be expanded if needed.
I'm closing this since the example pretty much examples "How to pass data back and forth". Feel free to reopen if it's unclear 😊
Isn't it possible to do with RouteSettings class? For example:
context.vRouter.to(
RegisterCompleteScreen.routeName,
arguments: MyDataObject(),
);
VWidget(
path: LoginScreen.routeName,
widget: (context, arguments) => LoginScreen(arguments.data as MyDataObject),
),
Hi there, After migrating my whole project to use
vrouter
I came across a case I'm not sure how to solve properly, would appreciate the help. I have a posts list with filter option which navigates the user to a new screen, then he chooses all the filter he wants and then press "Apply" button and it pop back to the posts list screen with the data he chose to filter and the posts list refreshes according to that data. Code explanation:User press "filter" button:
Note:
I also pass data when pushing to show the filter with the applied filters from before (if exists).User selects the filters he wants and press "Apply":
3.
Some filter logic
is being called since user popped back with data.This process can repeat it self and pass data back and forth.
I'm not sure if
queryParameters
could help me since the filter will have many parameters in the future and I don't want the url to be very long and weird.I hope I explained my case clearly. Thanks!