[英]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.