{"id":763,"date":"2023-07-27T05:56:56","date_gmt":"2023-07-27T05:56:56","guid":{"rendered":"https:\/\/www.devopssupport.in\/blog\/?p=763"},"modified":"2023-07-27T05:56:57","modified_gmt":"2023-07-27T05:56:57","slug":"flutter-webviews-gives-neterr_cache_miss-message","status":"publish","type":"post","link":"https:\/\/www.devopssupport.in\/blog\/flutter-webviews-gives-neterr_cache_miss-message\/","title":{"rendered":"Flutter webviews gives net::ERR_CACHE_MISS message"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.devopssupport.in\/blog\/wp-content\/uploads\/2023\/07\/WhatsApp-Image-2023-07-27-at-10.28.36-AM-edited.jpeg\" alt=\"\" class=\"wp-image-765\" width=\"540\" height=\"338\" srcset=\"https:\/\/www.devopssupport.in\/blog\/wp-content\/uploads\/2023\/07\/WhatsApp-Image-2023-07-27-at-10.28.36-AM-edited.jpeg 540w, https:\/\/www.devopssupport.in\/blog\/wp-content\/uploads\/2023\/07\/WhatsApp-Image-2023-07-27-at-10.28.36-AM-edited-300x188.jpeg 300w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/figure>\n\n\n\n<p>The error message &#8220;web page not available&#8221; with the description &#8220;net::ERR_CACHE_MISS&#8221; typically occurs in Flutter apps that use the webview_flutter plugin when they are uploaded to the Play Store. This issue arises due to a security restriction in modern WebView implementations on Android. <\/p>\n\n\n\n<p>Make sure you are using the latest version of the webview_flutter plugin. Check for updates in your <code>pubspec.yaml<\/code> file and ensure you are using the most recent version available.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;uses-permission android:name=\"android.permission.INTERNET\" \/>\r\n<\/code><\/pre>\n\n\n\n<p>The <code>webview_flutter<\/code> plugin may require a specific cache mode to work correctly on Android. To handle cache mode, you can set the <code>CacheMode<\/code> to <code>LOAD_DEFAULT<\/code> in your WebView configuration. To do this, modify the code where you create the WebView widget. <\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import 'package:flutter\/material.dart';\r\nimport 'package:webview_flutter\/webview_flutter.dart';\r\n\r\nclass MyWebView extends StatelessWidget {\r\n  @override\r\n  Widget build(BuildContext context) {\r\n    return WebView(\r\n      initialUrl: 'https:\/\/example.com',\r\n      javascriptMode: JavascriptMode.unrestricted,\r\n      \/\/ Set cache mode to LOAD_DEFAULT\r\n      initialData: WebResourceResponse(\r\n        mimeType: 'text\/html',\r\n        statusCode: 200,\r\n      ),\r\n    );\r\n  }\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>Before uploading the updated app to the Play Store, thoroughly test the app to ensure that the issue is resolved and that the web pages load properly. Once you have confirmed that the issue is resolved, generate a new APK or App Bundle and upload it to the Play Store.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The error message &#8220;web page not available&#8221; with the description &#8220;net::ERR_CACHE_MISS&#8221; typically occurs in Flutter apps that use the webview_flutter plugin when they are uploaded to the&#8230; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-763","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/comments?post=763"}],"version-history":[{"count":1,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/763\/revisions"}],"predecessor-version":[{"id":766,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/763\/revisions\/766"}],"wp:attachment":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/media?parent=763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/categories?post=763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/tags?post=763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}