This package is discontinued and will receive no further updates

PLEASE NOTE: Use go_router instead.


A router that handles request URIs with wildcards and generate URIs with parameters.


  1. Set up WebRouter
    final router = WebRouter();

If you want to show error pages, please add error pages.

    router.addForbiddenRoute((request) => ForbiddenPage());
    router.addNotFoundRoute((request) => NotFoundPage());
    router.addInternalErrorRoute((request) => InternalErrorPage());

Please add URIs of page. You can add URIs with wildcards.

    router.addRoute('/login', (request) => LoginPage());
    router.addRoute('/', (request) => DashboardPage());
    router.addRoute('items/index', (request) => ItemListPage());
    router.addRoute('items/view/{itemId}', (request) => ItemViewPage(request: request));

If you want to verify a user, please add filters.

LoginVerificationFilter is a sample class that implements WebFilter class.


Finally, you can set a transition.

    // set OnComplete handler
    router.setOnComplete((settings, widget) {
      // fade transition
      return PageRouteBuilder(
        settings: settings,
        pageBuilder: (_, __, ___) => widget,
        transitionsBuilder: (_, anim, __, child) {
          return FadeTransition(
            opacity: anim,
            child: child,
  1. set to onGenerateRoute
    return MaterialApp(
  1. navigate with WebRequest

If you want to request URIs used wildcards, use WebRequest.

    final request = WebRequest.request(
      data: {
        'itemId': '1',
    await Navigator.of(context).pushNamed(