Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues : context.beamBack(data : {data : example}); #622

Open
vfa-tienld opened this issue Jun 19, 2023 · 12 comments
Open

Issues : context.beamBack(data : {data : example}); #622

vfa-tienld opened this issue Jun 19, 2023 · 12 comments

Comments

@vfa-tienld
Copy link

I have 2 screens searchA and Search B , when from SearchA -> SearchB , and SearchB I do back by function context.beamBack(data : data); But in the SearchA screen I don't know how to print or log because the data I pass from the SearchB screen ?

@vfa-tienld
Copy link
Author

Screenshot 2023-06-19 at 4 48 57 PM

@vfa-tienld vfa-tienld changed the title Isule context.beamBack(data : {data : example}); Issues : context.beamBack(data : {data : example}); Jun 19, 2023
@r-ilagan
Copy link

You need to be able to pass data to SearchA after beaming back from SearchB. Can you show us how your routing is handled?

@vfa-tienld
Copy link
Author

It is here
Screenshot 2023-06-20 at 12 21 11 AM
Screenshot 2023-06-20 at 12 21 16 AM

@vfa-tienld
Copy link
Author

@r-ilagan I don't understand navigator by next router, it is normal to receive data, but when I use beamerBack() to return to searchA, I can't do the same

@vfa-tienld
Copy link
Author

@r-ilagan
Can you solve this problem? I want to get the value from B ->A and use it directly in the SearchA widget, this value will change when I return

@r-ilagan
Copy link

I'm guessing that SearchA is HomeLocation in this case? You can print data in your buildPages() method to see what it contains. Another approach is using a query parameter that you can also access with the state var

@vfa-tienld
Copy link
Author

vfa-tienld commented Jun 19, 2023

@r-ilagan
Yes, you are right, SearchA is HomeLocation, I log data with print(data) command into HomeLocation it already has data from beamerBack What is causing me problem is how to put that data into my SearchA wiget to use, give me an example that can get data from this HomeLocation , thank you very much

@r-ilagan
Copy link

No problem. You can make a nullable value in your child for ChangeNotifierProvider that takes in the data object. I would also suggest that you use widgets instead of functions as they are ever slightly more efficient to use. In any case, don't forget to check if data is null before you use it and handle the case when it is null. Good luck

@vfa-tienld
Copy link
Author

@r-ilagan Actually here I used Notifier to handle embedding data from beamBack returned, the problem is when back to SearchA it can't update that data variable, so it always has Null value, I need a specific illustration here, please help me

@r-ilagan
Copy link

Hmm I'm not too familiar with this approach. Perhaps you can notify your listeners so they can rebuild?

@vfa-tienld
Copy link
Author

@r-ilagan So how do you build to get data from beamBack() function ? give me your example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@r-ilagan @vfa-tienld and others