initialRoute property Null safety
The name of the first route to show, if a Navigator is built.
Defaults to dart:ui.PlatformDispatcher.defaultRouteName, which may be overridden by the code that launched the application.
If the route name starts with a slash, then it is treated as a "deep link",
and before this route is pushed, the routes leading to this one are pushed
also. For example, if the route was
/a/b/c, then the app would start
with the four routes
/a/b/c loaded, in that order.
Even if the route was just
/a, the app would start with
loaded. You can use the onGenerateInitialRoutes property to override
Intermediate routes aren't required to exist. In the example above,
/a/b could be skipped if they have no matching route. But
required to have a route, else initialRoute is ignored and
Navigator.defaultRouteName is used instead (
/). This can happen if the
app is started with an intent that specifies a non-existent route.
The Navigator is only built if routes are provided (either via home, routes, onGenerateRoute, or onUnknownRoute); if they are not, initialRoute must be null and builder must not be null.
- Navigator.initialRoute, which is used to implement this property.
- Navigator.push, for pushing additional routes.
- Navigator.pop, for removing a route from the stack.
final String? initialRoute;