Skip to content
pubscout

katana_router

3.4.0, released 5 weeks ago by mathru.net

Automatically create type-safe routing configurations using annotations and build_runner.

$ flutter pub add katana_router
Source repository

What it does

Katana Router generates type-safe routing and deep-linking configurations using build_runner and annotations. It allows developers to define pages using widget annotations and automatically wires them up into an application router.

AI-written summary of version 3.4.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want type-safe navigation and parameter passing without string-based paths.
  • You prefer annotation-based page configuration combined with build_runner.

Skip it when

  • You want a pure runtime router without build_runner dependency generation.
  • You prefer standard declarative routing configuration via go_router.

Strengths

  • Type-safe navigation and deep linking parameters.
  • Reduces boilerplate by generating route configurations directly from page widgets.
  • Supports nested and tabbed navigation.

Weaknesses

  • Requires build_runner code generation steps for updating routes.
  • Tied to the Katana ecosystem and specific annotations.

Setup

Kind
Flutter widgets
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
3

Requires adding katana_router along with build_runner and katana_router_builder as dev dependencies, then running build_runner.

import "package:katana_router/katana_router.dart";
import "package:flutter/material.dart";

part "home.page.dart";

@PagePath("/")
class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @pageRouteQuery
  static const query = _$HomePageQuery();

  @override
  Widget build(BuildContext context) {
    return const Scaffold(body: Center(child: Text("Home page")));
  }
}

Alternatives

Packages that do the same job and could replace katana_router.

  • go_router

    You want official, declarative routing without code generation.

  • auto_route

    You want an alternative annotation-driven type-safe router with its own feature set.

Works with

Packages commonly used together with katana_router: ones it builds on, ones built on it, and its own family.