How to show "You're offline" when web view app open without internet in Flutter Web view App?
306
You can use this Package For checking Internet connection is available or not.
bool result = await DataConnectionChecker().hasConnection;
return Scaffold(
body: WebView(
if (result == true) {
initialUrl: "https://google.com/",
onWebViewCreated: (WebViewController webViewController){
_controller.complete(webViewController);
},}
else{
//i am not connected to any network
}
) );
Comments
-
mishalhaneef over 1 year
I create a WebView app in Flutter. But when the App open without internet its showing this enter image description here
I want to show here another image when open this app without internet. like redirecting to a page like your not connected or something How do I do that?