Inside onPopInvokedWithResult
you should do:
if (didPop) return;
final shouldPop = await webViewController.canGoBack();
if (shouldPop) {
webViewController.goBack();
}
Check this from Flutter's documentation. The example is different, but the logic is similar.