DEV Community

Cover image for Flutter tip (#4): run a Flutter app to a specific route
Pedro Massango
Pedro Massango

Posted on • Edited on

Flutter tip (#4): run a Flutter app to a specific route

Few days ago I found an hidden gem in the main Flutter repository and shared it on my Twitter account and today I tought its better to share on my blogpost.

Have you ever wanted to run your Flutter app straight to a specific named route? yes it is possible.

This is helpful when you:

  • Want to test a specific page in your app and you don't want to run the whole app and navigate to that page by yourself.
  • Want to test deep link in your Flutter app.
  • (other) you may need it for many other use-cases :)

Show me the code

All you need to do is to run the flutter command with the --route parameter:

pedromassago$ flutter run --route /routeName

The --route parameter expect a string that is the route name that will be used to start your application with. In the case above the app will start with the /routeName page in your screen.

Notes

This feature is only available for Android devices at the time this post was written. There is a open issue to bring support for other platform like iOS at flutter/flutter/issues/4703. If you wan this feature on iOS you can thumbs up the issue to get it fixed sooner.

Thanks for you time! 😉

Top comments (0)