Routes and navigation
Each feature declares its routes through FeatureDescriptor.routes. The platform collects those contributions and configures the app’s router using GoRouter.
How the pieces fit together
Declare a route
This descriptor fragment uses ordinary Flutter widgets. Import material_ui/material_ui.dart, go_router/go_router.dart, and vyuh_core/vyuh_core.dart in your feature library.
final catalog = FeatureDescriptor(
name: 'catalog',
title: 'Catalog',
routes: () => [
GoRoute(
path: '/catalog',
builder: (_, _) => const Scaffold(
body: Center(child: Text('Catalog')),
),
),
],
);Include the descriptor in the app’s feature list and use initialLocation: '/catalog' when that is the desired first screen. The quick start shows the complete composition.
Choose the navigation operation
Use the shared navigation capability through vyuh.router. This keeps router ownership with the app.
// Navigation fragments inside a running Vyuh app.
vyuh.router.go('/catalog');
vyuh.router.push('/account');
vyuh.router.replace('/account/settings');go selects a new route configuration. push adds a page to the stack. replace replaces the current page. See the navigation plugin APIs for the return values and available operations.
Parameters and nested routes
Use GoRouter path parameters and query parameters for route data. Keep route contracts public and deliberate when another feature needs to navigate into your feature. Avoid reaching into the destination’s private widget state.
Lazy features
A lazy descriptor declares route prefixes and a loader. When requested, the runtime loads the feature and replaces its placeholders with the feature’s real routes. Concurrent requests share activation. Startup and lifecycle explains dependencies and readiness.
Avoid route collisions
Choose distinct paths for independent features. Keep initial location aligned with a declared route. Test deep links, back navigation, parameter handling, and route lifecycle cleanup as part of the consuming app.