initialRoute property

String initialRoute

The name of the first route to show.

By default, this defers to dart:ui.Window.defaultRouteName.

If this string contains any / characters, then the string is split on those characters and substrings from the start of the string up to each such character are, in turn, used as routes to push.

For example, if the route /stocks/HOOLI was used as the initialRoute, then the Navigator would push the following routes on startup: /, /stocks, /stocks/HOOLI. This enables deep linking while allowing the application to maintain a predictable route history.

If any of the intermediate routes doesn't exist, it'll simply be skipped. In the example above, if /stocks doesn't have a corresponding route in the app, it'll be skipped and only / and /stocks/HOOLI will be pushed.

That said, the full route has to map to something in the app in order for this to work. In our example, /stocks/HOOLI has to map to a route in the app. Otherwise, initialRoute will be ignored and defaultRouteName will be used instead.


final String initialRoute