Replies: 1 comment 9 replies
-
Oh, that’s interesting; wouldn’t have guessed that would trigger that assert, but now that I see that the assert is triggered, it makes sense as to why. The build of the parent widget concludes and then the LayoutBuilder is built after the fact. I’m not sure on a proper fix for the assert. For now, add a RearchBuilder inside of the LayoutBuilder and invoke the buildContent function with the WidgetHandle from that RearchBuilder. Then, make the Parent subclass StatelessWidget. |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My design of having abstract classes that calls the
buildContent
abstract method and passes it aWidgetHandle
works fine.But now I'm trying to pass to that function the parent size by using a
LayoutBuilder
and this error triggers:So my questions are:
If I'm correct, this would be easily checked by having a bool
building
variable that istrue
while executing thebuild
method, so you can modify that assertion to use this new variable.Example:
I do use
composition
instead ofinheritance
, but it is basically the same.Beta Was this translation helpful? Give feedback.
All reactions