Flutter webview iOS 错误“targetPlatform.macOS 的默认 webview 实现,但没有”

2024-03-20

我是 Flutter 新手,我尝试了 Flutter 的 webview,它在 Android 上运行良好

I was trying to check it for iOS and I got enter image description here

我在用

webview_flutter:^3.0.0

这是我的代码

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() => runApp(ScreenerWebView());

class ScreenerWebView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Screener',
      home: Scaffold(
        appBar: PreferredSize(
            preferredSize: Size.fromHeight(0),
            child: AppBar(
              // ignore: prefer_const_constructors
              title: SizedBox(
                height: kToolbarHeight,
              ),
            )),
        // ignore: prefer_const_constructors
        body: WebView(
          initialUrl: "https://www.google.com/",
          javascriptMode: JavascriptMode.unrestricted,
        ),
      ),
    );
  }
}

webview_flutter https://pub.dev/packages/webview_flutter软件包不支持 macOS 目标,这就是您看到错误的原因

when you're on package's pubdev have a look on the flutter badge under Published x days ago, most of the time it will tell you which platforms are supported, in case of webview_flutter https://pub.dev/packages/webview_flutter it's only android and ios enter image description here

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Flutter webview iOS 错误“targetPlatform.macOS 的默认 webview 实现,但没有” 的相关文章

随机推荐