nocterm_unrouter 0.2.0
nocterm_unrouter: ^0.2.0 copied to clipboard
Declarative nested router for Nocterm apps with guards and nested outlets.
Nocterm Unrouter #
Routing for Nocterm apps with nested layouts, guards, params, query state, and named navigation.
Install #
dart pub add nocterm_unrouter
Quick Start #
import 'package:nocterm/nocterm.dart';
import 'package:nocterm_unrouter/nocterm_unrouter.dart';
import 'package:unstory/unstory.dart';
final router = createRouter(
history: MemoryHistory(initialEntries: [HistoryLocation(Uri(path: '/'))]),
routes: const [
Inlet(path: '/', view: HomeView.new),
Inlet(
path: '/docs',
view: DocsPage.new,
children: [Inlet(path: 'intro', view: IntroPage.new)],
),
],
);
Future<void> main() async {
await runApp(NoctermApp(child: RouterView(router: router)));
}
class HomeView extends StatelessComponent {
const HomeView({super.key});
@override
Component build(BuildContext context) {
return const Text('Home');
}
}
class DocsPage extends StatelessComponent {
const DocsPage({super.key});
@override
Component build(BuildContext context) {
return const Column(children: [Text('Docs'), Expanded(child: Outlet())]);
}
}
class IntroPage extends StatelessComponent {
const IntroPage({super.key});
@override
Component build(BuildContext context) {
return const Text('Intro');
}
}
Use this package when you want terminal screens to follow the same route-tree model as the Flutter package.
Learn More #
- Nocterm example
- unrouter if you want the all-in-one package