ffca-routing
FFCA Routing
Workflow for wiring navigation in an FFCA monorepo. The patterns and code shapes live in ${CLAUDE_PLUGIN_ROOT}/references/ffca/navigation.md and in ${CLAUDE_PLUGIN_ROOT}/references/code_templates/presentation_templates.md. Read them before wiring routes.
The core constraint
Features are isolated, so a feature cannot know the app's global routing table. It never imports the app's router or another feature's routes. Navigation is a dependency the app layer injects: the app decides what happens next, the feature only detects when it is needed. Read the intro of references/ffca/navigation.md, then follow the pattern that fits the feature's depth.
Choose the injection pattern
- Shallow widget trees: callbacks on the module. The module constructor takes typed callbacks (
onProductTapped,onCheckoutStarted) and the app supplies them. Readreferences/ffca/navigation.md, section Simple features: pass callbacks directly, and adapt the module example inreferences/code_templates/presentation_templates.md. - Deep widget trees: a navigation interface. Define a plain Dart class in the feature's presentation package holding every navigation action, require it in the module, and provide it to the subtree with
Provider.value. Deep widgets then callcontext.read<CartNavigation>().onProductTapped(id)with no prop drilling. Readreferences/ffca/navigation.md, section Deep trees: define a navigation interface.
Whichever you pick, the callback at the module boundary is the compile-time-safe cross-feature contract.
Wire routes in the app layer with go_router_builder
Use go_router with go_router_builder. The app defines @TypedGoRoute and GoRouteData classes that instantiate feature modules and wire their callbacks to typed route navigation. Adapt the GoRouteData template in references/code_templates/presentation_templates.md.