Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do the webview in flutter cached web page?

I want to cache the web page I display in flutter webview so to improve my performance, no need to reload the page. Is that available? and can I implement it?

like image 860
hoangquyy Avatar asked Dec 05 '19 04:12

hoangquyy


1 Answers

flutter_inappwebview(former flutter_inappbrowser)
Has parameter cacheEnabled and default is ture
cacheEnabled: Sets whether WebView should use browser caching. The default value is true

flutter_webview_plugin community version
Has parameter appCacheEnabled to enable cache

WebviewScaffold(
    key: _scaffoldKey,
    url: widget.url,
    clearCache: true,
    appCacheEnabled: true,      
);

webview_flutter official version
Do not provide parameter , you can check with Android Source code https://github.com/flutter/plugins/blob/master/packages/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebView.java

default cache mode depend on iOS WKWebView and Android WebView
default cache mode of Android WebView is LOAD_DEFAULT https://developer.android.com/reference/android/webkit/WebSettings#LOAD_DEFAULT
Default cache usage mode. If the navigation type doesn't impose any specific behavior, use cached resources when they are available and not expired, otherwise load resources from the network

like image 63
chunhunghan Avatar answered Oct 13 '22 04:10

chunhunghan