Named Routes
Centralized route definitions and navigation by name
Named routes let you define all navigation paths in one place. Click each concept to see how route tables work.
Define a map of route names to widget builders in MaterialApp. The router looks up the name and builds the matching screen.
MaterialApp(
routes: {
'/': (ctx) => HomeScreen(),
'/settings': (ctx) => SettingsScreen(),
'/profile': (ctx) => ProfileScreen(),
},
)Click a route to see it resolve
Route name
Widget
HomeScreen
SettingsScreen
ProfileScreen
PostScreen