![](/img/trans.png)
[英]Error: 'CupertinoPageRoute' isn't a type. Flutter (Android Studio)
[英]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 關於它:
在Visual Studio Code中打開位置/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.5/lib/src/
在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.