'owner._debugCurrentBuildTarget == this , is not true

[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



Solution 1:[1]

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.

Solution 2:[2]

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.
]);

Solution 3:[3]

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.

Solution 4:[4]

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

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joe Muller
Solution 2 DevSec Guy
Solution 3 Mozes
Solution 4 Acidic