Skip to content
pubscout

go_router_paths

0.2.2, released 3 years ago by mrgnhnt.com

Helper package to define type-safe paths for go_router and other routers without hardcoded strings.

WASM-ready
$ flutter pub add go_router_paths
Source repository

What it does

Provides a structured way to define navigation paths, parameters, and query strings in one central location. It removes the need for hardcoded string paths throughout your application and handles URI encoding automatically.

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

Use it when

  • You want to avoid hardcoded route strings in your GoRouter configuration
  • You need a type-safe and structured way to handle path parameters and query strings

Skip it when

  • You prefer code generation for your routes
  • You do not use go_router or similar path-based navigation packages

Strengths

  • Centralizes route path definitions
  • Handles URL component encoding automatically
  • Provides helper classes for parameters and child routes

Weaknesses

  • Requires manual class setup for every path structure
  • Does not generate routes automatically via build_runner

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
class AppPaths {
  static Path get home => Path('home');
  static WelcomePath get welcome => WelcomePath();
}

class WelcomePath extends Path<WelcomePath> {
    WelcomePath() : super('welcome');

    Path get login => Path('login', parent: this);
}

Alternatives

Packages that do the same job and could replace go_router_paths.

  • auto_route

    Provides a robust, code-generated routing solution with type-safe arguments out of the box.

  • go_router_builder

    Uses code generation to type-check go_router parameters and routes natively.