We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05def7f commit 38e315bCopy full SHA for 38e315b
1 file changed
lib/src/webview_scaffold.dart
@@ -76,20 +76,11 @@ class _WebviewScaffoldState extends State<WebviewScaffold> {
76
super.initState();
77
webviewReference.close();
78
79
- _onBack = webviewReference.onBack.listen((_) {
+ _onBack = webviewReference.onBack.listen((_) async {
80
if (!mounted) return;
81
82
- final route = ModalRoute.of(context);
83
-
84
- // Close the native widget only if the back operation was not veto'd
85
- // by the [WillPopScope] widget or similar.
86
- final handler = () => webviewReference.close();
87
- route?.addScopedWillPopCallback(handler);
88
- try {
89
- // Perform the 'back' operation.
90
- Navigator.of(context).pop();
91
- } finally {
92
- route?.removeScopedWillPopCallback(handler);
+ if (await Navigator.maybePop(context)) {
+ webviewReference.close();
93
}
94
});
95
0 commit comments