[英]Flutter showing old errors
我正在編寫一個 flutter 應用程序,但是當我想在 Android Emulator (Ctrl+F5) 上測試它時,我遇到了一個無法修復的錯誤。 這是其中的一部分:
I/flutter (13782): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (13782): The following assertion was thrown during performResize():
I/flutter (13782): Vertical viewport was given unbounded height.
I/flutter (13782): Viewports expand in the scrolling direction to fill their container. In this case, a vertical
I/flutter (13782): viewport was given an unlimited amount of vertical space in which to expand. This situation
I/flutter (13782): typically happens when a scrollable widget is nested inside another scrollable widget.
I/flutter (13782): If this widget is always nested in a scrollable widget there is no need to use a viewport because
I/flutter (13782): there will always be enough vertical space for the children. In this case, consider using a Column
I/flutter (13782): instead. Otherwise, consider using the "shrinkWrap" property (or a ShrinkWrappingViewport) to size
I/flutter (13782): the height of the viewport to the sum of the heights of its children.
I/flutter (13782):
I/flutter (13782): The relevant error-causing widget was:
I/flutter (13782): ListView (file:///D:/flutterProjects/test_project/test_project/lib/screens/all_obj_screen.dart:19:18)
正如您在最后一行中看到的,它說錯誤的原因是D:/flutterProjects/test_project/test_project/lib/screens/all_obj_screen.dart
的ListView
。 問題是我在那個文件中沒有ListView
(目前,但我以前有它)而且那個路徑甚至不存在了!
如果有幫助,這是all_obj_screen.dart
文件:
class AllObjScreen extends StatefulWidget {
@override
_AllObjScreenState createState() => _AllObjScreenState();
}
class _AllObjScreenState extends State<AllObjScreen> {
@override
Widget build(BuildContext context) {
final objects = Provider.of<Objs>(context);
return Center(
child: Text(
'${objects.items.length}',
style: TextStyle(
color: Colors.white,
fontSize: 25,
),
),
);
}
}
所以我認為問題不在於我的代碼,而在於 Visual Studio Code。 如何解決這個問題?
編輯:我嘗試在 Visual Studio Code 和 Android Studio 上運行該應用程序,但問題是相同的。 我也試過重新安裝 IDE 和 flutter,但根本沒有運氣。
自 1.12 版以來,我遇到了同樣的問題。 重啟設備會清除日志,但我希望 Flutter 能在未來的版本中糾正這個問題。 這只是使用 android 設備發生的。 在 iOS 中工作正常。
嘗試:
flutter logs -c
(要清除日志,請在項目目錄中運行)
清潔過程后,然后按 CTRL + C 並為以下問題回答 Y。 希望它會有所幫助。 謝謝
你可以看到它: https : //github.com/flutter/flutter/issues/46815 。 此問題已在 flutter 1.12.13+hotfix8 版本中修復。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.