routingkit 2.0.2 copy "routingkit: ^2.0.2" to clipboard
routingkit: ^2.0.2 copied to clipboard

Routing Kit - Lightweight and fast router. - A composable pure function routing kit.

example/main.dart

import 'package:routingkit/routingkit.dart';

void main() {
  final router = createRouter<String>();

  addRoute(router, 'get', '/path', 'Static path');
  addRoute(router, 'get', '/path/:name', 'Param route');
  addRoute(router, 'get', '/path/**', 'Wildcard route');
  addRoute(router, 'get', '/path/**:name', 'Named wildcard route');
  addRoute(
      router, 'get', '/files/:dir/:filename.:format,v:version', 'Mixed route');

  // Static
  print(findRoute(router, 'get', '/path'));

  // // Param
  print(findRoute(router, 'get', '/path/seven'));

  // Wildcard
  print(findRoute(router, "get", "/path/foo/bar/baz"));

  // Mixed
  print(findRoute(router, "GET", "/files/pubspec.yaml.dart,v1"));

  // Print debug string
  print(router.toDebugString());
}
3
likes
0
pub points
26%
popularity

Publisher

verified publisherodroe.dev

Routing Kit - Lightweight and fast router. - A composable pure function routing kit.

Repository (GitHub)
View/report issues

Topics

#router #routing #route #fast-router #routing-kit

Funding

Consider supporting this project:

github.com

License

unknown (license)

More

Packages that depend on routingkit