繁体   English   中英

错误:'kethrow' 不是类型。 kethrow _ClientSocketException(错误,request.url);

[英]Error: 'kethrow' isn't a type. kethrow _ClientSocketException(error, request.url);

构建 flutter 应用程序出现错误。当我尝试构建我的应用程序时发生错误。 错误是:

**/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.5/lib/src/io_client.dart:88:7: Error: 'kethrow' isn't a type.
      kethrow _ClientSocketException(error, request.url);
      ^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.5/lib/src/io_client.dart:88:15: Error: Expected ';' after this.
      kethrow _ClientSocketException(error, request.url);
              ^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.5/lib/src/io_client.dart:88:43: Error: Expected ')' before this.
      kethrow _ClientSocketException(error, request.url);
                                          ^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.5/lib/src/io_client.dart:48:30: Error: A non-null value must be returned since the return type 'IOStreamedResponse' doesn't allow null.
- 'IOStreamedResponse' is from 'package:http/src/io_streamed_response.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.5/lib/src/io_streamed_response.dart').
package:http/src/io_streamed_response.dart:1
  Future<IOStreamedResponse> send(BaseRequest request) async {
                             ^
3

FAILURE: Build failed with an exception.

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

* 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 5m 45s
Exception: Gradle task assembleDebug failed with exit code 1**

如何解决此错误。在此先感谢。

几天前我遇到了这个错误。 奇怪的是来自 dart 文件。 我的是“希思罗”。 我通过以下文件的链接更正了它:/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.5/lib/src/io_client.dart。

如何 go 关于它:

  1. Visual Studio Code中打开位置/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.5/lib/src/

  2. src文件夹中,打开io_client.dart (确保您在src文件夹中的io_client.dart中)

进入io_client.dart ,找到出现错误的位置:在您的情况下,它显示 88:7 即第 88 行第 7 列。滚动到第 88 行并将“kethrow”更改为“throw”

应该更正下图中标记的其他地方的错误,并且您的io_client.dart应该没有错误。

注意: io_client.dart之外的其他文件可能会标记为红色,表示错误,但没关系。 只需将您的更改保存在io_client.dart文件中并关闭该文件。 一旦关闭

再次打开您的项目并在终端中运行flutter clean

下一次运行flutter pub get

下次运行flutter pub upgrade

再次运行您的应用程序,一切都应该正常。

在此处输入图像描述

但我建议您不要总是将 go 放入这些文件中以编辑任何内容。 我这样做是因为我已经尝试了所有可能的解决方案,但无法解决它,并且在最后期限内交付客户工作。 我什至按照 flutter 医生的建议为 windows 安装了 Visual Studio,但这不是解决方案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM