Skip to content

Routing Guide

Air Framework leverages go_router for navigation but simplifies it by allowing each module to define its own routes.

Each module contributes to the global routing table by returning a list of AirRoute objects.

class CatalogModule extends AppModule {
@override
List<AirRoute> get routes => [
AirRoute(
path: '/catalog',
builder: (context, state) => const CatalogView(),
routes: [
AirRoute(
path: ':id',
builder: (context, state) => ProductDetailView(id: state.pathParameters['id']!),
),
],
),
];
}

Since it’s built on go_router, you can use all standard navigation methods.

context.go('/catalog');
context.push('/catalog/123');

You can define shell routes for persistent UIs (like bottom navigation bars).

AirRoute(
path: '/app',
builder: (context, state) => MainScaffold(child: state.child),
routes: [
AirRoute(path: 'home', builder: (_, __) => HomeView()),
AirRoute(path: 'settings', builder: (_, __) => SettingsView()),
],
)

The ModuleManager collects all routes from all registered modules and provides them to the AirRouter, which builds the final configuration for MaterialApp.router.