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

High-performance trie-node router. It is based on Trie-Node and supports dynamic, static, parameter, wildcard routing, etc.

example/main.dart

import 'package:routingkit/routingkit.dart';

void main() {
  final router = TrieRouter();

  // Dsiplay all log records to the console.
  router.logger.onRecord.listen(print);

  // Register a route with a constant path component.
  router.register(0, '/users/:id/friends/:friend_id'.asSegments);
  router.register(1, '/users/:id/friends/:friend_id'.asSegments);

  final params = Params();

  // Lookup a route with a constant path component.
  final result = router.lookup('/users/123/friends/456'.asPaths, params);

  print(result); // 1
  print(params.keys); // {id, friend_id}
  print(params.get('id')); // 123
  print(params.get('friend_id')); // 456
}

// Full console output:
// ```
// [INFO] Routing Kit: Overriding duplicate route for users (:id, friends, :friend_id)
// 2
// {id, friend_id}
// 123
// 456
// ```
3
likes
160
pub points
26%
popularity

Publisher

verified publisherodroe.dev

High-performance trie-node router. It is based on Trie-Node and supports dynamic, static, parameter, wildcard routing, etc.

Repository (GitHub)
View/report issues

Topics

#routing #router #routing-kit #trie #trie-node

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

logging

More

Packages that depend on routingkit