Flutter webview iOS 错误 "default webview implementation for targetPlatform.macOS but there isn't one"

Flutter webview iOS error "default webview implementation for targetPlatform.macOS but there isn't one"

我是 Flutter 的新手,我尝试了 webview 和 flutter,它与 Android

配合得很好

我试图检查它是否有 iOS,但我得到了

我正在使用

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 软件包不支持 macOS 目标,这就是您看到错误的原因

当你在 package 的 pubdev 上查看 Published x days ago 下的 flutter 徽章时,大多数时候它会告诉你支持哪些平台,如果是 webview_flutter 只有 android 和 ios