owner._debugCurrentBuildTarget == this , is not true
Asked Answered
B

8

28

[on web] tried to fit some widgets inside a FittedBox like this :

 FittedBox(
   fit: BoxFit.scaleDown,
   child: AnimatedContainer(...)
 )

but screen and console show only this message :

error

there's nothing else in the console

what's the next step here ? :D

Brokendown answered 1/12, 2019 at 23:24 Comment(0)
B
5

More Info was provided by the framework after a little messing around with the code , like extra children , random sizes to parents . . .

Error >> ... object was given an infinite size during layout

ultimately some like this worked :

FittedBox(
 fit: BoxFit.scaleDown,
 child: Container(
   height: MediaQuery.of(context).size.height * .65,
   child: AnimatedContainer(...)
)
Brokendown answered 3/12, 2019 at 14:14 Comment(0)
H
24

I was getting this error inside of a CustomScrollView because one of my widgets wasn't inside of a SliverToBoxAdapter.

SliverToBoxAdapter(
  child: Row(
    children: [
      Text('Activity',
      style: TextStyle(fontWeight: FontWeight.w600, fontSize: 18),),
    ],
  ),
)

I'd just make sure all widgets in your sliver list are actually slivers.

Hulen answered 26/1, 2021 at 18:20 Comment(1)
This answer is correct. It solved the problem in my case.Baird
B
5

More Info was provided by the framework after a little messing around with the code , like extra children , random sizes to parents . . .

Error >> ... object was given an infinite size during layout

ultimately some like this worked :

FittedBox(
 fit: BoxFit.scaleDown,
 child: Container(
   height: MediaQuery.of(context).size.height * .65,
   child: AnimatedContainer(...)
)
Brokendown answered 3/12, 2019 at 14:14 Comment(0)
S
3

I was getting this error because somewhere in my code, I applied a wrong widget mistakenly, and that was the same stateless widget that I was writing. To make it more clear:

stateless widget - MyWidget //For example
.
.
.
Now somewhere in between the code:

Column(
children: [
MyWidget(), //This went wrong, I was supposed to Use some other widget.
]);
Schindler answered 4/5, 2021 at 19:25 Comment(1)
Same happened with me. I was calling HomePage() within HomePage() widget. Thanks.Conjoint
B
0

I encountered this error as a result of incorporating multiple Consumer widgets of the same model Provider. Solution was to follow Provider package guidelines of incorporating one Consumer widget at the top of the widget tree where the state object is to be shared from.

Boer answered 23/2, 2022 at 15:50 Comment(0)
V
0

Just answering this because none of the Answers above worked for me:

My IDE (VSCode) changed the initState() method to async because I accidentally wrote a method as "await" and then just tapped the autoerrorfix

Vilmavim answered 10/6, 2022 at 12:39 Comment(0)
M
0

I just wrap with container (with height=constant) it worked for me

Masturbation answered 8/7, 2022 at 15:25 Comment(1)
same as the accepted answer then :)Brokendown
F
0

if the error appears when you have clicked button at the bottom sheet, just set enabledrag to false.

      builder: (context) => BottomSheet(
                  onClosing: () {},
                  enableDrag: false,
Function answered 3/11, 2022 at 6:37 Comment(0)
E
0

I got this error because of my bloc provider

      @override
      Widget build(BuildContext context) {
      return BlocProvider(

your build method should return BlocProvider first !

Eatton answered 11/12, 2022 at 19:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.