Getting started
Install
Section titled “Install”flutter pub add raku_routerraku_router needs only flutter — no state-management or design-system dependency.
Your routes are data
Section titled “Your routes are data”Define routes as a sealed hierarchy so the switch that maps them to screens
is checked for exhaustiveness by the compiler. No code generation.
sealed class AppRoute extends RakuRoute { const AppRoute();}class Home extends AppRoute { const Home(); }class NoteDetail extends AppRoute { const NoteDetail(this.id); final String id; @override List<Object?> get props => [id];}Render a stack (no deep linking)
Section titled “Render a stack (no deep linking)”A RouteStack is a reactive List<route>. Drop a RouteStackView into
MaterialApp.home (or any design system’s shell):
final stack = RouteStack(const Home());
MaterialApp( home: RouteStackView( stack: stack, builder: (context, route) => switch (route as AppRoute) { Home() => const HomeScreen(), NoteDetail(:final id) => NoteScreen(id: id), }, ),);Navigate from anywhere
Section titled “Navigate from anywhere”No constructors to thread — read the nearest stack from the context:
context.push(const NoteDetail('42'));context.pop();- Add URLs and deep linking with the route tree.
- Give each tab its own back stack with tabs.
- Try it live in the demo.