Skip to content

flutter run --route="/route" doesn't work. #10813

@gspencergoog

Description

@gspencergoog

Steps to Reproduce

I created a test app:

import 'package:flutter/material.dart';

void main() {
  runApp(new MaterialApp(
    home: new Center(child: new Builder(builder: (BuildContext context) {
      debugPrint("Building Home page, initial route is "
          "${Navigator.of(context).widget.initialRoute}.");
      return new Text("Home");
    })),
    routes: <String, WidgetBuilder>{
      "/route": (BuildContext context) {
        debugPrint("Building Route page, initial route is "
            "${Navigator.of(context).widget.initialRoute}.");
        new Center(child: new Text("Route"));
      },
    },
  ));
}

When I run the app with:

flutter run --route="/route"

I get the following debug output:

I/flutter (14968): Building Home page, initial route is /.

I expected it to be starting the "Route" page, and printing:

Building Route page, initial route is /route.

Maybe I'm just doing it wrong, but that's the behavior I would expect.

Logs

[I added extra debug output to the run command to print the ADB command, so I was sure it was being passed: the line starting with "Command will be..."]

Launching lib/main.dart on Android SDK built for x86 in debug mode with route /route...
Running 'gradle assembleDebug'...                     5.9s
Built build/app/outputs/apk/app-debug.apk (21.6MB).
Installing build/app/outputs/apk/app.apk...           0.7s
Command will be [/Users/gspencer/Library/Android/sdk/platform-tools/adb, -s, emulator-5554, shell, am, start, -a, android.intent.action.RUN, -f, 0x20000000, --ez, enable-background-compilation, true, --ez, enable-dart-profiling, true, --es, route, /route, --ez, enable-checked-mode, true, com.yourcompany.src/com.yourcompany.src.MainActivity]
I/flutter (14968): Building Home page, initial route is /.
Syncing files to device Android SDK built for x86...  1.4s

🔥  To hot reload your app on the fly, press "r". To restart the app entirely, press "R".
An Observatory debugger and profiler on Android SDK built for x86 is available at: http://127.0.0.1:60106/
For a more detailed help message, press "h". To quit, press "q".

[no analyze problems]

Flutter Doctor

[✓] Flutter (on Mac OS X 10.12.5 16F73, locale en-US, channel unknown)
• Flutter at /Users/gspencer/code/flutter
• Framework revision 5b3e60d0e6 (11 minutes ago), 2017-06-17 14:15:11 -0700
• Engine revision 18fdfb8
• Tools Dart version 1.24.0-dev.6.7

[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
• Android SDK at /Users/gspencer/Library/Android/sdk
• Platform android-25, build-tools 25.0.3
• ANDROID_HOME = /Users/gspencer/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] iOS toolchain - develop for iOS devices (Xcode 8.3.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 8.3.2, Build version 8E2002
• ios-deploy 1.9.1
• CocoaPods version 1.2.1

[✓] Android Studio (version 2.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Gradle version 3.2
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Ultimate Edition (version 2017.1.4)
• Flutter plugin version 14.0
• Dart plugin version 171.4694.29

[✓] Connected devices
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions