CopyPastor

Detecting plagiarism made easy.

Score: 1; Reported for: Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2023-05-27
by berkaykurkcu

Original Post

Original - Posted on 2020-06-25
by devDeejay



            
Present in both answers; Present only in the new answer; Present only in the old answer;

I recently had the same issue, and altering Expanded/Flexible widgets fixed this issue for me.
I had errors like these in my VS Code
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════ The following assertion was thrown while applying parent data.: Incorrect use of ParentDataWidget. The ParentDataWidget Expanded(flex: 1) wants to apply ParentData of type FlexParentData to a RenderObject, which has been set up to accept ParentData of incompatible type StackParentData. Usually, this means that the Expanded widget has the wrong ancestor RenderObjectWidget. Typically, Expanded widgets are placed directly inside Flex widgets. The offending Expanded is currently placed inside a Stack widget.
I wrapped a Column that contains a Flexible widget with an Expanded widget like this ->
return Container( ................. child: Expanded( child: Column( ......... children:[ Flexible( child: Text( .........
Simply removing parent **Expanded** fixed my issue. Here is the updated code:
return Container( ................. child: Column( ......... children:[ Flexible( child:Text( .........
When you run your app in debug mode and when something goes wrong, you see the scary red error screen with logs. In release mode, you just see a grey screen.
Now, when you ran your app in debug mode, at times there are some errors which are thrown but we mistakenly ignore them as we see the app is running perfectly on screen but if you open your logs in debug mode, you will see some error messages.
For me it was something like this:
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════ The following assertion was thrown while applying parent data.: Incorrect use of ParentDataWidget. The ParentDataWidget Expanded(flex: 1) wants to apply ParentData of type FlexParentData to a RenderObject, which has been set up to accept ParentData of incompatible type StackParentData. Usually, this means that the Expanded widget has the wrong ancestor RenderObjectWidget. Typically, Expanded widgets are placed directly inside Flex widgets. The offending Expanded is currently placed inside a Stack widget.

My app runs perfectly in debug mode while Flutter still throws this error in the background.
Now when I run the app in release mode, I see a grey screen which is different from my perfectly running app in debug mode.
When I checked the logs, I see the error message:
Flutter app show grey screen in release mode but works fine in debug mode Instance of 'DiagnosticsProperty<void>'
**So the solution?**
Run you app in debug mode and check logs, I am sure you will find the problem there. Changing Flutter channels won't help as long as there are errors in your code.

        
Present in both answers; Present only in the new answer; Present only in the old answer;