This works perfectly when the user clicks on the back button in the app bar. In Android devices, when the user performs a swipe-to-go-back gesture from the right edge of the screen, not able to return data in this case.
I tried using PopScope but not able to navigate to previous screen with data to be returned.
I'm looking for a way to handle the swipe-to-go-back gesture in Android so that I can still return data when the user swipes to navigate back.
PopScope(
canPop: true,
onPopInvoked: (didPop) {}, // deprecated
onPopInvokedWithResult: (didPop, result) {
Navigator.of(context).pop(true);
},