nocterm_unrouter 0.2.0 copy "nocterm_unrouter: ^0.2.0" to clipboard
nocterm_unrouter: ^0.2.0 copied to clipboard

Declarative nested router for Nocterm apps with guards and nested outlets.

Nocterm Unrouter #

Test pub dart license

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 #

1
likes
160
points
9
downloads

Documentation

API reference

Publisher

verified publishermedz.dev

Weekly Downloads

Declarative nested router for Nocterm apps with guards and nested outlets.

Repository (GitHub)
View/report issues

Topics

#router #navigation #terminal #tui #cli

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

nocterm, unrouter_core, unstory

More

Packages that depend on nocterm_unrouter