Skip to content
pubscout

navigation_utils

0.9.11, released 10 months ago by an unverified publisher

A Navigator 2 wrapper bringing back Navigator 1 style APIs with deep linking and URL routing.

WASM-ready
$ flutter pub add navigation_utils
Source repository

What it does

Simplifies Flutter's Navigator 2 routing system by reimplementing standard Navigator 1 methods like push, pop, and set on top of RouterDelegate and RouteInformationParser. It provides declarative route definitions using URL mapping with native support for query and path parameters. It also includes deep linking destination structures and arbitrary object passing through global data.

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

Use it when

  • You want Navigator 2 capabilities (like deep linking and web URL handling) without abandoning familiar imperative push/pop navigation calls.
  • You need path parameters and query parameter parsing without building custom Navigator 2 boilerplate.
  • You want deep linking configurations defined as data collections in a single location.

Skip it when

  • You prefer compile-time type-safe code-generated routes.
  • Your project is already committed to popular industry-standard routing solutions like go_router or auto_route.

Strengths

  • Reimplements familiar Navigator 1 imperative methods (push, pop, pushNamed) over Navigator 2.
  • Handles URL stripping and rebundling to correctly support query parameters on the web.
  • No code generation step required, allowing fast iteration and straightforward setup.

Weaknesses

  • Global singleton NavigationManager pattern can complicate custom dependency injection setups.
  • URL query parameters and path parameters are passed as weakly typed strings, requiring manual parsing.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0

Initialize NavigationManager in main() and plug the delegate/parser into MaterialApp.router.

void main() {
  final routes = [
    NavigationData(
      url: '/',
      builder: (context, routeData, globalData) => const HomeScreen(),
    ),
    NavigationData(
      url: '/details/:id',
      builder: (context, routeData, globalData) => DetailsScreen(
        id: routeData.pathParameters['id'],
      ),
    ),
  ];

  NavigationManager.init(
    mainRouterDelegate: DefaultRouterDelegate(navigationDataRoutes: routes),
    routeInformationParser: DefaultRouteInformationParser(),
  );

  runApp(MaterialApp.router(
    routerDelegate: NavigationManager.instance.routerDelegate,
    routeInformationParser: NavigationManager.instance.routeInformationParser,
  ));
}

Alternatives

Packages that do the same job and could replace navigation_utils.

  • go_router

    Pick go_router if you prefer the official Flutter team-supported declarative routing package.

  • auto_route

    Pick auto_route if you want strongly-typed routes, nested navigation guards, and compile-time code generation.

  • beamer

    Pick beamer if you want state-driven navigation designed around discrete 'location' concepts.