【问题标题】:Error: The getter 'hellawait' isn't defined for the class 'IOClient'错误:没有为类 'IOClient' 定义 getter 'hellawait'
【发布时间】:2022-06-17 05:39:32
【问题描述】:

我创建并运行了一个基于位置和天气的应用。但是当我关闭 VS Code 并尝试重新安装应用程序时,出现以下错误!。 如何消除错误!。

Launching lib\main.dart on Infinix X655C in debug mode...
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/io_client.dart:35:34: Error: Expected ')' before this.
      var ioRequest = (hellawait _inner!.openUrl(request.method, request.url))
                                 ^^^^^^

/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/io_client.dart:35:24: Error: The getter 'hellawait' isn't defined for the class 'IOClient'.
- 'IOClient' is from 'package:http/src/io_client.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/io_client.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'hellawait'.
      var ioRequest = (hellawait _inner!.openUrl(request.method, request.url))
                       ^^^^^^^^^

FAILURE: Build failed with an exception.

* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\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 50s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

【问题讨论】:

  • 您不知何故不小心修改了.pub-cache 目录中的代码(可能是通过错误的全局搜索/替换?)。我建议删除C:\flutter\.pub-cache\hosted\pub.dartlang.org\http-0.13.4 并重新运行flutter pub get
  • 它帮助了我。非常感谢!

标签: flutter dart flutter-dependencies flutter-web


【解决方案1】:

我早就知道了,但是

flutter pub cache repair

帮了我

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-11
    • 2021-02-11
    • 2019-12-01
    • 2023-01-25
    • 1970-01-01
    • 2022-12-19
    • 2021-06-06
    • 2021-11-22
    相关资源
    最近更新 更多