I use this plugin in my flutter app - webview_flutter. I need to show the local HTML file in webview. This is not from assets, but I have a path to this file. I try it:
Read the file as a string
var file = File(_path); var data = await file.readAsString();
prepare the string
String _getHtml() { var html = Uri.dataFromString(data, mimeType: 'text/html').toString(); return html; }
Show this string in my webview
WebView( initialUrl: _getHtml(), )
But I have get error(on step Uri.dataFromString) :
How fix it? Any tips?