During Flutter development, I learned that swiping the screen navigates back. I resolved the issue by using the WillPopScope widget. However, I noticed that the WillPopScope widget is deprecated in the official documentation. Therefore, I am looking for an alternative.
After WillPopScope is disabled, I want to find an alternative for
WillPopScope(onWillPop: () async { return false; })
I found was this alternative but it doesn’t work
return PopScope(
canPop: false,
onPopInvoked: (bool didPop) {
if (didPop) {
return;
}
}
New contributor
Shawn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.