I guess this is just another feature request for Flutter presenting a local webpage as a WebView Widget - and all of it OFFLINE and originating from html, css and other asset files.
There are several Flutter plugins that are able to show a webView from a URL (being online) - but I haven't seen a solution yet for presenting a WebView from local assets offline.
A typical webpage with several pages (files and folders placed in the Flutter assets) would look like this:
index.html
page1.html
page2.html
/images/img1.jpg
/images/img2.jpg
/css/p1.css
/css/p2.css
etc.
I read the following discussions (see links below) and more but I don't grasp from it if there will ever be the technical possibility in Flutter for an offline WebView Widget or not.
Is it just a matter of time we have to wait for a plugin-team to implement this - or will this never be possible in Flutter at all ? I would like to receive a more fundamental answer than what I am able to grasp after having played with Flutter for 5-6 weeks.
Here is some discussion I've found about the subject:
How to display custom html instead of URL #23
Load HTML from assets or local files #27086
The inAppWebView
plugin does this procedure to read offline html file or online:
Link to the plugin: https://pub.dev/packages/flutter_inappwebview#-installing-tab-
Example:
InAppWebView(
initialFile: "assets/index.html"
)
Where in initialFile you pass the path of your HTML file that is inside your flutter project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With