我從去年開始學習flutter,并創建了一個小專案,運行良好,然后停止學習,直到現在......
所以今天,在將flutter更新到最新版本(2.5.0)并再次開始運行該專案后,當我試圖再次運行它時,我被這個錯誤卡住了:
Launching liborder_route.dart on ASUS X01BDA in debug mode...
運行Gradle任務'assembleDebug'...
/D:/progie/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widgets-0.1。 12/lib/src/tagged_text/tagged_text.dart:295:36: 錯誤。沒有命名的引數具有名稱'nullOk'。
MediaQuery.of(context, nullOk: true)?.textScaleFactor ?
^^^^^^
/D:/progie/flutter/packages/flutter/lib/src/widgets/media_query.dart:841:25。語境。發現這個候選人,但引數不匹配。
static MediaQueryData of(BuildContext context) {
^^
/D:/progie/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widgets-0.1.12/lib/src/feature_discovery/src/overlay_widgets.dart:239:20: 錯誤。getter 'title' isn't defined for the class 'TextTheme' 。
- 'TextTheme' is from 'package: flutter/src/material/text_theme. dart' ('/D: /progie/flutter/packages/flutter/lib/src/material/text_theme。 dart')。)
嘗試 糾正 the name to the name of an existing getter。或 定義 一個 獲取器 or field named 'title' 。
style。theme.title.copyWith(color: Colors.white)。)
^^^^^
/D:/progie/flutter/。 pub-cache/hosted/pub.dartlang. org/flutter_widgets-0.1。 12/lib/src/feature_discovery/src/overlay_widgets。 dart:248:20: Error: The getter 'subhead' isn't defined for the class 'TextTheme' 。
- 'TextTheme' 是 來自 'package。 flutter/src/material/text_theme。 dart' ('/D: /progie/flutter/packages/flutter/lib/src/material/text_theme。 dart')。)
嘗試 糾正 the name to the name of an existing getter。或 定義 一個 獲取器 or field named 'subhead' 。
style。theme.subhead.copyWith(color: Colors.white70)。)
^^^^^^^
失敗。Build failed with an exception.
* Where:
Script 'D: progieflutterpackagesflutter_toolsgradleflutter。 gradle' line: 1005
* 什么 去了 錯了。
執行 失敗 對于 任務 '。 app:compileFlutterBuildDebug' 。
> Process 'command 'D: progieflutterbinflutter。 bat'' finished with non- zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. 運行 用 --資訊 或 --debug 選項。 title">option to get more log output. 運行 與 --掃描 to get full insights。
* 獲取 更多 幫助 at https。 //help. gradle.org。
BUILD FAILED in14s
Exception: Gradle task assembleDebug failed with exit code 1
我已經做了什么 :
- 運行flutter doctor,一切正常 。
- 驗證快取/重新啟動 在pubspec.yaml中發布升級。
但是一點幫助都沒有
我使用的是android studio 4.1版本。從錯誤來看,代碼有700行左右,但我不知道哪部分產生了上述錯誤,而且我甚至沒有在代碼中使用TextTheme或MediaQuery。
正在運行的pub已經過時了:
顯示過時的軟體包。
[*]表示不是最新的可用版本。
包名稱 當前可升級的可解決的最新版本
直接依賴關系:所有最新的。
跨越式依賴關系。
async *2.8.1 *2.8. 1 *2.8.1 2.8.21.1.0 *1.1. 0 *1.1.0 1.2.0
csslib *0.16.2 *0.16. 2 *0.16.2 0.170
html *0.14.0 4 *0.14。 0 4 *0.14。 0 4 0.15.0。
匹配器 *0.12.10 *0.12。 10 *0.12.10 0.120.112.1.5 *2.1。 5 *2.1.5 3.0.1
橫向的dev_dependencies。
test_api *0.4.2 *0.4。 2 *0.4.2 0.4.3
所有的依賴都是最新的。
行程結束,退出代碼0。
該問題是否與上述依賴關系有關?
非常感謝您的幫助,提前感謝您!
uj5u.com熱心網友回復:
在過去的一年中,flutter發生了很多事情。你升級到2.5意味著你的flutter專案將有null safety,你可能需要將你的任何依賴關系更新到它們的最新版本,這些依賴關系可能支持null safety。所以這個錯誤來自于flutter widgets包。如果您檢查https://pub.dev/packages/flutter_widgets,它顯示該軟體包已不再更新,所以它已經過時了,建議您使用其中一個可用的替代品。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/330185.html
標籤:
上一篇:Python多處理管理器在FlaskAPI中使用時顯示錯誤
下一篇:如何使AR成為你庫中的默認工件
