routingkit 4.1.0 copy "routingkit: ^4.1.0" to clipboard
routingkit: ^4.1.0 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 route');
  addRoute(router, 'POST', '/path/:name', 'name route');
  addRoute(router, 'GET', '/path/foo/**', 'wildcard route');
  addRoute(router, 'GET', '/path/foo/**:name', 'named wildcard route');

  print(findRoute(router, 'GET', '/path')); // => { data: static route }
  print(findRoute(router, 'POST', '/path/cady')); // => { data: name route, }
  print(findRoute(
      router, 'GET', '/path/foo/bar/baz')); // => { data: wildcard route }
  print(findRoute(router, 'GET', '/')); // => null, not found.
}
3
likes
160
points
295
downloads

Publisher

verified publisherodroe.dev

Weekly Downloads

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

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

More

Packages that depend on routingkit