Flutter hot reload fails on the code below
import 'package:flutter/material.dart';
void main() {
runApp(
Center(
child: Text(
'Hello, world!',
textDirection: TextDirection.ltr,
),
),
);
}
but it works if I extract a widget out of main method as below.
import 'package:flutter/material.dart';
void main() {
runApp(HelloWorldWidget());
}
class HelloWorldWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Text(
'Hello World 7',
textDirection: TextDirection.ltr,
),
);
}
}
Why does hot reload work in one case but not the other?