Will there be an offline webview from local asset html-files in Flutter?

2,710

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.

Share:
2,710
iKK
Author by

iKK

Updated on December 09, 2022

Comments

  • iKK
    iKK over 1 year

    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

  • Muhammad Anus
    Muhammad Anus almost 3 years
    i try this but it's ruined my file design ):