Skip to content
pubscout

duck_router

7.3.4, released 3 months ago by jaspervanriet.nl

Intent-based router for Flutter with deep linking and nested navigation.

WASM-ready
$ flutter pub add duck_router
Source repository

What it does

DuckRouter lets you define routes as intent classes, providing type-safe navigation and interceptors for pre-navigation logic. It supports dynamic route registration, deep linking, and nested navigation out of the box.

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

Use it when

  • You need type-safe, intent-based routing with deep linking support
  • You want to add authentication or feature-flag interceptors
  • You require nested navigation without boilerplate

Skip it when

  • You prefer a code-generation based router like auto_route
  • You need extensive custom page transition animations not covered by DuckRouter

Strengths

  • Type-safe intent classes reduce navigation errors
  • Built-in interceptors simplify auth and feature-flag flows
  • Dynamic registry allows routes to be added at runtime
  • Supports deep linking and nested navigation

Weaknesses

  • No code generation support
  • Documentation is limited compared to go_router
  • Custom page transitions may require extra work

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
3

Add DuckRouter to MaterialApp.router and call DuckRouter.of(context).navigate()

final router = DuckRouter(initialLocation: const HomeLocation());
return MaterialApp.router(routerConfig: router);

class HomeLocation extends Location {
  const HomeLocation();
  @override
  String get path => '/home';
  @override
  LocationBuilder get builder => (context) => const HomeScreen();
}

Alternatives

Packages that do the same job and could replace duck_router.

  • go_router

    Popular, well-documented, supports code generation and extensive customizations

Works with

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