defaultRouteName property

  1. @override
String defaultRouteName
override

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

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

Android

On Android, calling FlutterView.setInitialRoute will set this value. The value must be set sufficiently early, i.e. before the runApp call is executed in Dart, for this to have any effect on the framework. The createFlutterView method in your FlutterActivity subclass is a suitable time to set the value. The application's AndroidManifest.xml file must also be updated to have a suitable <intent-filter>.

iOS

On iOS, calling FlutterViewController.setInitialRoute will set this value. The value must be set sufficiently early, i.e. before the runApp call is executed in Dart, for this to have any effect on the framework. The application:didFinishLaunchingWithOptions: method is a suitable time to set this value.

See also:

Implementation

@override
String get defaultRouteName => _defaultRouteNameTestValue ?? _platformDispatcher.defaultRouteName;