Flutter: to close a webview when you left the page

Issue

I have a segmented control and, in one of its pages, I have a webview. I want to close my web view automatically when I change page from the segmented control. Some suggestion?

Solution

you may work on the dispose event of your StateFullWidget and close your webview when your component or page disposed :

@override
void dispose() {
  // close the webview here
  super.dispose();
}

Answered By – khairy Mohamed

Answer Checked By – Pedro (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *