I noticed that when I extend MaterialPageRoutes and then instance them like this
class Route extends MaterialPageRoute {
Route(): super(
builder: (context) {
return SomeWidget();
}
);
}
...somewhere in the build method of another class...
Navigator.push(context, Route())
a hot-reload will not rebuild the contents of the route like it does when I do
...somewhere in the build method of another class...
Navigator.push(context, MaterialPageRoute(
builder: (context) {
return SomeWidget();
}
))
or
class Route extends MaterialPageRoute {
Route(): super(
builder: (context) {
return RouteWidget();
}
);
}
class RouteWidget extends StatelessWidget {
Widget build(BuildContext context) {
return SomeWidget();
}
}
...somewhere in the build method of another class...
Navigator.push(context, Route())
I find it especially weird that the last work-around works. Any idea what I'm missing? The documentation says that a hot-reload will rebuild all widgets.