Home > Mobile >  Flutter - webview to load local HTML can load out there, sometimes when not
Flutter - webview to load local HTML can load out there, sometimes when not

Time:12-30

Problem: the flutter of the load on the mobile phone in the local storage space index. The HTML file, sometimes can be loaded out, sometimes load not to come out,
(not in asset HTML)
couldn't load error message : Unhandled Exception: Unable to load asset:/storage/emulated/0/Android/data/com. Test. The app/files/test/index HTML ';
When loading out , will make more copies of the HTML (index1. HTML index2. HTML and index3. HTML) and then turn in an absolute path, there is always a normal load out??

Why ah, it's the same file, the same to the absolute path,

_loadHtmlFromAssets () is async {
String filePath='/storage/emulated/0/Android/data/com. Test. The app/files/test/index HTML';
String fileHtmlContents=await rootBundle. LoadString (filePath);
_webViewController. LoadUrl (Uri. DataFromString (fileHtmlContents,
MimeType: getH5Constant ABTEST_MIMETYPE, encoding: encoding getByName (getH5Constant. ABTEST_ENCODINGTYPE)). The toString ());
}
  • Related