在我的info.plist文件中添加了密钥 io.flutter.embedded_views_preview =是
在webview中加载base 64转换后的html字符串。在...工作正常 android但iOS我在上面提到的错误
String htmlText =getHTML(cp);
final String contentBase64 = base64Encode(const Utf8Encoder().convert(htmlText));
String url = 'data:text/html;base64,$contentBase64';
this.child = WebView(
initialUrl: url,javascriptMode: JavascriptMode.unrestricted,javascriptChannels: <JavascriptChannel>[
_cpJavascriptChannel(buildContext,cp),].toSet(),onWebViewCreated: (WebViewController webViewController) {
_controller.complete(webViewController);
},navigationDelegate: (NavigationRequest request) {return NavigationDecision.prevent;}
);
JavascriptChannel _cpJavascriptChannel(BuildContext context,chargePoints.ChargePoint cp) {
return JavascriptChannel(
name: 'ChargePoint',onmessageReceived: (JavascriptMessage message) {
Navigator.of(buildContext).pushReplacementNamed('/chargePoint',arguments: {'cp':cp,'connector':message.message});
});
}