How do I send data back to a view when the view is anonymous (I am writing a library that takes a user from his present view to another, then return the users back to the initial view but also with a payload/data). In my code I go back to the anonymous previous view using:
Navigator.pop(context);
but how do I send data (string or object) along with it? or does flutter have a message dispatcher that is received by all views who listen for it?
Use
Navigator.pop(context, data);
The caller needs to listen it using
var data = await Navigator.push(...);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.