未为类型“MyApp”定义方法“WebView”?

问题描述 投票:0回答:1

我面临 WebView 抖动问题,代码编辑器无法识别它所说的 WebView

The method 'WebView' isn't defined for the type 'MyApp'. (Documentation)  Try correcting the name to the name of an existing method, or defining a method named 'WebView'.

我通过这个命令添加了WebView包“webview_flutter

$ flutter pub add webview_flutter

扑医生:

D:\src\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel stable, 3.19.0, on Microsoft Windows [Version 10.0.19045.4046], locale en-US)
    • Flutter version 3.19.0 on channel stable at D:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision bae5e49bc2 (5 days ago), 2024-02-13 17:46:18 -0800
    • Engine revision 04817c99c9
    • Dart version 3.3.0
    • DevTools version 2.31.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\dell\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: D:\Android Sudio Setup\Installed\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2023.1)
    • Android Studio at D:\Android Sudio Setup\Installed
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)

[√] VS Code (version 1.86.2)
    • VS Code at C:\Users\dell\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.82.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.4046]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 121.0.6167.185
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 121.0.2277.112
    ! Device ZXPRHAJZWSEM9LNN is not authorized.
      You might need to check your device for an authorization dialog.

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
Process finished with exit code 0

pubspec.yaml
代码也存在
webview_flutter: ^4.7.0
依赖性问题,它在单词
webview
下划线,并且说:
Typo: In word 'webview'

我已经做了几乎所有的事情来修复这个错误/问题,但我认为它永远不会从计算机中消失,但我希望在你的帮助下我能摆脱这个错误。

这是完整的项目链接。 开车:

https://drive.google.com/file/d/1IfRPvrw1fseKM-qrM_bowYyoAU-h5FQM/view?usp=sharing

flutter android-studio webview flutter-dependencies mobile-application
1个回答
0
投票

版本4.0.0开始,

WebView
小部件被删除,其功能已分为
WebViewController
WebViewWidget
。如果您的代码库中有旧的
WebView
实现,请遵循 此迁移指南

© www.soinside.com 2019 - 2024. All rights reserved.