routingkit 0.1.0 copy "routingkit: ^0.1.0" to clipboard
routingkit: ^0.1.0 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'.pathComponents);
  router.register(1, '/users/:id/friends/:friend_id'.pathComponents);

  final parameters = Parameters();

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

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

// Full console output:
// ```
// [INFO] trie-router: Overriding duplicate route for users :id/friends/:friend_id
// 2
// {id, friend_id}
// 123
// 456
// ```
3
likes
0
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

Funding

Consider supporting this project:

github.com

License

unknown (license)

Dependencies

logging

More

Packages that depend on routingkit