defaultRouteName property

String get defaultRouteName

The route or path that the embedder requested when the application was launched.

Accessing this value returns the value contained in the PlatformDispatcher singleton, so instead of getting it from here, you should consider getting it from WidgetsBinding.instance.platformDispatcher instead (or, when WidgetsBinding isn't available, from PlatformDispatcher.instance). The reason this value forwards to the PlatformDispatcher is to provide convenience for applications that only use a single main window.

This will be the string "/" if no particular route was requested.

Android

On Android, the initial route can be set on the initialRoute method of the FlutterActivity's intent builder.

On a standalone engine, see https://flutter.dev/docs/development/add-to-app/android/add-flutter-screen#initial-route-with-a-cached-engine.

iOS

On iOS, the initial route can be set with the FlutterViewController.setInitialRoute initializer.

On a standalone engine, see https://flutter.dev/docs/development/add-to-app/ios/add-flutter-screen#route.

See also:

Implementation

String get defaultRouteName => platformDispatcher.defaultRouteName;