是否有可能从本地 Assets 加载完整的网站(包括相关文件)?我尝试使用 flutter 插件 webview_flutter
并加载了 index.html。
Future<String> loadLocal() async {
return await rootBundle.loadString('assets/mywebsite/index.html');
}
只有 html 代码正在呈现,相关的 javascript 不工作。
最佳答案
可以关注https://github.com/flutter/flutter/issues/27086
与此同时,您可以在 Dart 中实现一个网络服务器,该服务器提供 Assets 中的文件并将 WebView 指向该集成网络服务器。
https://medium.com/@segaud.kevin/facebook-oauth-login-flow-with-flutter-9adb717c9f2e是关于如何在 Dart 中做到这一点。
关于webview - 如何从 Assets 加载完整的网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54617509/