GithubHelp home page GithubHelp logo

medz / routingkit Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 108 KB

๐Ÿ›ธ Routing Kit - Lightweight and fast router for Dart.

License: MIT License

Dart 100.00%
dart flutter router routing routing-kit

routingkit's Introduction

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 "routingkit";

const router = createRouter();

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

Match route to access matched data

// {data: Static path}
findRoute(router, 'get', '/path')

// {data: Param route, params: {name: seven}}
findRoute(router, 'get', '/path/seven')

// {data: Wildcard Route, params: {_: foo/bar/baz}}
findRoute(router, 'get', '/path/foo/bar/baz')

// {data: Mixed Route, params: {dir: dart, filename: pubspec, format: yaml, version: 1}}
findRoute(router, 'get', '/files/dart/pubspec.yaml,v1')

// `null`, No match.
findRoute(router, 'get', '/')

License

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.