0Pricing
Flutter Mobile Development · Lesson

Named Routes & Arguments

Utilize named routes for cleaner navigation and pass data between screens using route arguments effectively.

Why Named Routes?

In previous lessons, we used MaterialPageRoute for navigation. While effective for simple apps, managing many routes this way can get messy.

  • Each route requires a new MaterialPageRoute instance.
  • Harder to identify screens by a unique name.
  • Can lead to repetitive code.

Named routes offer a cleaner, more structured way to manage your app's navigation.

Defining Named Routes

To use named routes, you define them in your MaterialApp widget. This is done using the routes property.

  • The routes property takes a Map.
  • The key is the route's name (a String, e.g., '/details').
  • The value is a function that builds the widget for that route.

The '/' route is special; it's your app's initial route.

All lessons in this course

  1. Basic Page Navigation
  2. Named Routes & Arguments
  3. TabBars & Drawers
  4. Deep Linking & URL Navigation
← Back to Flutter Mobile Development