!_needsLayout 异常怎么处理?

来源:6-7 卡片组件封装与优化

小资要奋斗

2021-06-22

======== Exception caught by scheduler library =====================================================
The following assertion was thrown during a scheduler callback:
Updated layout information required for RenderIndexedSemantics#55c1c NEEDS-LAYOUT to calculate semantics.
'package:flutter/src/rendering/object.dart':
Failed assertion: line 2658 pos 12: '!_needsLayout'


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack: 
#2      RenderObject._getSemanticsForParent (package:flutter/src/rendering/object.dart:2658:12)
#3      RenderObject._getSemanticsForParent.<anonymous closure> (package:flutter/src/rendering/object.dart:2680:61)
#4      Iterable.forEach (dart:core/iterable.dart:257:30)
#5      RenderSliverVariableSizeBoxAdaptor.visitChildren (package:flutter_staggered_grid_view/src/rendering/sliver_variable_size_box_adaptor.dart:294:29)
#6      RenderObject.visitChildrenForSemantics (package:flutter/src/rendering/object.dart:2765:5)
...
====================================================================================================

写回答

1回答

CrazyCodeBoy

2021-06-23

_needsLayout是flutter系统内部抛出的异常,导致这个异常的情况有很多,需要具体问题具体分析,亲是在做什么操作的报的这个异常呢,将操作还原试试看还是否有这个异常

0
0

Flutter高级进阶实战-仿哔哩哔哩-掌握Flutter高阶技能

一次性掌握Flutter高阶技能+商业级复杂项目架构设计与开发方案

1722 学习 · 870 问题

查看课程