[Solved] Flutter Failed assertion: line 1982 pos 12: ‘hasSize’

2022/08/11 16:35

Exception

The following assertion was thrown during performLayout():

RenderBox was not laid out: RenderFlex#d45aa relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

‘package:flutter/src/rendering/box.dart’:

Failed assertion: line 1982 pos 12: ‘hasSize’

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      RenderBox.size (package:flutter/src/rendering/box.dart:1982:12)

#3      ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:57:18)

#4      RenderFlex._computeSizes (package:flutter/src/rendering/flex.dart:896:45)

#5      RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:931:32)

The following RenderObject was being processed when the exception was fired: RenderFlex#2b73c NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Solution

Expanded→Expanded→FittedBox. You have a neighboring dual Expand widgets. You need to remove extra Expanded widget.

Leave a Reply

Back to top