gradle 错误:dothrow不是flutter http包的类型

hrirmatl  于 2023-06-30  发布在  Flutter
关注(0)|答案(1)|浏览(117)

我正在尝试运行我的Flutter应用程序,我遇到了这个问题:
使用硬件渲染与设备sdk gphone x86 64.如果您注意到图形伪影,请考虑使用“--enable-software-rendering”启用软件渲染。正在调试模式下在sdk gphone x86 64上启动lib/main.dart...

../../../.pub-cache/hosted/pub.dev/http-0.13.6/lib/src/io_client.dart:94:8: Error: 'dothrow' isn't a type.
       dothrow _ClientSocketException(error, request.url);
       ^^^^^^^
../../../.pub-cache/hosted/pub.dev/http-0.13.6/lib/src/io_client.dart:94:16: Error: Expected ';' after this.
       dothrow _ClientSocketException(error, request.url);
               ^^^^^^^^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dev/http-0.13.6/lib/src/io_client.dart:94:38: Error: The 'records' language feature is disabled for this library.
Try removing the package language version or setting the language version to 3.0 or higher.
       dothrow _ClientSocketException(error, request.url);
                                     ^
../../../.pub-cache/hosted/pub.dev/http-0.13.6/lib/src/io_client.dart:54: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' ('../../../.pub-cache/hosted/pub.dev/http-0.13.6/lib/src/io_streamed_response.dart').
  Future<IOStreamedResponse> send(BaseRequest request) async {
                             ^
Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

* Where:
Script '/home/antonio.daniel/Dev/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1159

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/home/antonio.daniel/Dev/flutter/bin/flutter'' 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 1m 25s
Running Gradle task 'assembleDebug'...                             86.5s
Exception: Gradle task assembleDebug failed with exit code 1
q5lcpyga

q5lcpyga1#

运行:

flutter pub cache repair

这个命令解决了。

相关问题