在Webview中出现这样的错误尝试嵌入平台视图,但PaintContext不支持嵌入

  

在我的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});
            });
      }
qiaoqinag 回答:在Webview中出现这样的错误尝试嵌入平台视图,但PaintContext不支持嵌入

这是帮助我解决此问题的代码。

<key>io.flutter.embedded_views_preview</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>

您还可以从Flutter Documentations

了解更多有关新更改的信息。
本文链接:https://www.f2er.com/3152399.html

大家都在问