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

Routing Kit - Lightweight and fast router for Dart.

RoutingKit

Pub Version Test License Sponsors X (formerly Twitter) Follow

Routing Kit - Lightweight and fast router for Dart.

Installation #

Run this command:

dart pub add routingkit

With Flutter:

flutter pub add routingkit

Usage #

Create a router instance and insert routes #

import from "routingkit";

const router = createRouter();

addRoute(router, "GET", "/path", 'this path');
addRoute(router, "POST", "/path/:name", 'named route');
addRoute(router, "GET", "/path/foo/**", 'wildcard route');
addRoute(router, "GET", "/path/foo/**:name", 'named wildcard route');

Match route to access matched data #

// Returns [{ payload: 'this path' }]
findRoute(router, "GET", "/path");

// Returns [{ payload: 'named route', params: { name: 'fooval' } }]
findRoute(router, "POST", "/path/fooval");

// Returns [{ payload: 'wildcard route' }]
findRoute(router, "GET", "/path/foo/bar/baz");

// Returns undefined (no route matched for/)
findRoute(router, "GET", "/");

License #

RoutingKit is open-sourced software licensed under the MIT license.

3
likes
0
pub points
34%
popularity

Publisher

verified publisherodroe.dev

Routing Kit - Lightweight and fast router for Dart.

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