home property
The widget for the default route of the app (Navigator.defaultRouteName,
which is /
).
This is the route that is displayed first when the application is started normally, unless initialRoute is specified. It's also the route that's displayed if the initialRoute can't be displayed.
To be able to directly call Theme.of, MediaQuery.of, etc, in the code that sets the home argument in the constructor, you can use a Builder widget to get a BuildContext.
If home is specified, then routes must not include an entry for /
,
as home takes its place.
The Navigator is only built if routes are provided (either via home, routes, onGenerateRoute, or onUnknownRoute); if they are not, builder must not be null.
The difference between using home and using builder is that the home subtree is inserted into the application below a Navigator (and thus below an Overlay, which Navigator uses). With home, therefore, dialog boxes will work automatically, the routes table will be used, and APIs such as Navigator.push and Navigator.pop will work as expected. In contrast, the widget returned from builder is inserted above the app's Navigator (if any).
If this property is set, the pageRouteBuilder property must also be set so that the default route handler will know what kind of PageRoutes to build.
Implementation
final Widget? home;