Reputation: 1971
I want add data at all 'pop'
It two case,
Android back key and some button for 'navigator.(context).pop()
'
So I used WillPopScope but I can't add data like this
onWillPop: () async {
return Navigator.of(context).pop(myData));
},
this is not working.
How can I add data?
Upvotes: 0
Views: 829
Reputation: 5172
If you call
Navigator.of(context).pop(myData)
in your code, the pop
with arguments will be delivered if onWillPop
return true
.
When popping a page, onWillPop
has the duty to day "ok you can pop" or "ok you cannot".
Upvotes: 2