Another exception was thrown: type 'MyApp' is not a subtype of type 'StatelessWidget'

As Jonah Williams said,

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.


you need to restart your app for the changes to take effect. Hot reload won't work at this time


You need to Hot Reload by using R (shift + r) coz you change MyApp class from StatelessWidget to a StatefulWidget while your app is running.