Open vfa-tienld opened 1 year ago
You need to be able to pass data
to SearchA
after beaming back from SearchB
. Can you show us how your routing is handled?
It is here
@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
@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
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
@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
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
@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
Hmm I'm not too familiar with this approach. Perhaps you can notify your listeners so they can rebuild?
@r-ilagan So how do you build to get data from beamBack() function ? give me your example
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 ?