英文:
My flutter app is not running after adding screenshot package
问题
在我的Flutter应用程序中添加了截图包后,无法构建我的应用程序,出现以下错误:
错误:未定义名称 'View'。
screenshot.dart:154
        context == null ? fallBackView : View.maybeOf(context) ?? fallBackView;
                                     ^^^^
错误:没有名为 'view' 的命名参数。
screenshot.dart:164
      view: view,
      ^^^^
/C:/src/FlutterSDK/flutter/packages/flutter/lib/src/rendering/view.dart:68:3: 上下文:找到此候选项,但参数不匹配。
  RenderView({
  ^^^^^^^^^^
目标 kernel_snapshot 失败:异常
2
失败:构建失败,出现异常。
* 位置:
  脚本 'C:\src\FlutterSDK\flutter\packages\flutter_tools\gradle\flutter.gradle' 第 1151 行
* 出现了什么问题:
  任务 ':app:compileFlutterBuildDebug' 执行失败。
  > 进程 '命令 'C:\src\FlutterSDK\flutter\bin\flutter.bat'' 以非零退出值 1 结束
* 尝试:
  > 使用 --stacktrace 选项运行以获取堆栈跟踪。
  > 使用 --info 或 --debug 选项运行以获取更多日志输出。
  > 使用 --scan 选项运行以获取完整的见解。
* 获取更多帮助:https://help.gradle.org
6s 内构建失败
异常:Gradle 任务 assembleDebug 以退出码 1 失败
有什么建议可以提供吗?提前感谢您。
<details>
<summary>英文:</summary>
After adding the screenshot package on my flutter app,my app can not be build and it gives me this error : 
    : Error: Undefined name 'View'.
    screenshot.dart:154
            context == null ? fallBackView : View.maybeOf(context) ?? fallBackView;
                                             ^^^^
    : Error: No named parameter with the name 'view'.
    screenshot.dart:164
          view: view,
          ^^^^
    /C:/src/FlutterSDK/flutter/packages/flutter/lib/src/rendering/view.dart:68:3: Context: Found this candidate, but the arguments don't match.
      RenderView({
      ^^^^^^^^^^
    
    Target kernel_snapshot failed: Exception
    2
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Script 'C:\src\FlutterSDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1151
    
    * What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.
    > Process 'command 'C:\src\FlutterSDK\flutter\bin\flutter.bat'' finished with non-zero exit value 1
    
    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 6s
    Exception: Gradle task assembleDebug failed with exit code 1
any suggestions can be helpful.thank you in advance.
</details>
# 答案1
**得分**: 1
以下是已翻译的内容:
**1-** 你可以在电脑上通过命令提示符运行Flutter Doctor。
   你可以通过以下方式打开命令提示符:
   点击Windows开始按钮。
   输入"command prompt"并按回车键。
   一旦我们打开了命令提示符,你可以输入以下内容并按回车键:
    flutter doctor -v
**2-** 然后,如果你使用的是Android Studio,请尝试重新启动你的IDE,并清除缓存。
   在Android Studio中,你可以通过以下方式清除项目结构相关的信息:
    File > Invalidate Cache clears project structure related information (only) cached by Android studio.
**3-** 如果这没有奏效,请尝试更改包的版本号。
**4-** 最后,删除该包并用另一个包替换,可以从[github.com][1]或[pub.dev][2]获取另一个包。
   [1]: https://github.com
   [2]: https://pub.dev/
这就是我的解决方案,希望能够解决问题,祝一切顺利!
<details>
<summary>英文:</summary>
There are many solutions here are they:
**1-** You can run Flutter Doctor on a PC by using the command prompt. 
you can open the command prompt by: 
Clicking on the Windows Start button. 
Typing in command prompt and 
pressing Enter.
Once we have the command prompt open, you can type the following and hit enter:
    flutter doctor -v
**2-** Then try to restart your IDE if you had android studio go and delete cache from the 
    File > Invalidate Cache clears project structure related information (only) cached by Android studio.
**3-** if it didn't work try changing the package version number
**4-** lastly delete the package and replace it with another one either from [github.com][1] or [pub.dev][2]
  [1]: https://github.com
  [2]: https://pub.dev/
Thats my solution I hope it works, all the best!
</details>
				通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论