In flutter we can pass a stateless widget that returns a MaterialApp instance to the runApp() function like this:
void main()=>r
There's no difference in visual behavior. What changes is how hot reload behaves.
For example if you used runApp(MaterialApp()), changing from
runApp(MaterialApp(title: 'Foo'))
to
runApp(MaterialApp(title: 'Bar'))
then the hot reload wouldn't take changes into consideration.
While if you had the following class :
class MyApp {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Foo',
);
)
}
and used it like this :
runApp(MyApp())
then changing title of MyApp would be correctly hot reloaded.