Answers for "is not a subtype of type 'StatelessWidget' in type cast"

2

type 'MyApp' is not a subtype of type 'StatelessWidget' in type cast

If you changed MyApp from a StatelessWidget to a StatefulWidget you need to hot restart, since it is invoked in main

This has been explained multiple times in live coding sessions, that when you make changes in functions like initState(), you have to restart the app. A similar case applies for you, when you changed state related properties of the MyApp widget you need to restart your app for those changes to take effect.

Basically, when you hot reload the app, it calls the build() function, initState() is called only when you restart the app, so that the app reinitiates everything including the widget whose initState() function you changed.
Posted by: Guest on October-11-2021

Code answers related to "is not a subtype of type 'StatelessWidget' in type cast"

Browse Popular Code Answers by Language