flat_router 0.0.2
flat_router: ^0.0.2 copied to clipboard
A minimalistic declarative router with deep link support.
FlatRouter #
A minimalistic declarative router with deep link support.
- Very simple concept. Fully declarative.
- Just flat. No page stack or hierarchy model.
Usage #
Basic principle: You get the path string and do whatever you want.
void main() => runApp(MaterialApp.router(
routeInformationParser: FlatRouterParser(),
routerDelegate: FlatRouterDelegate(
builder: (context, path) {
if (path == '/') {
return HomeScreen();
}
if (path.startsWith('/settings')) {
return SettingsScreen(path);
}
return NotFoundScreen();
},
),
));
copied to clipboard
You maintain and update the path string yourself:
ElevatedButton(
child: Text('Open settings'),
onPressed: () {
context.updatePath('/settings/home');
},
)
copied to clipboard