Skip to content
pubscout

go_router_builder

4.5.3, released 3 weeks ago by flutter.dev

A code generator for type-safe route helpers and definitions with package:go_router.

Rock solid
$ flutter pub add go_router_builder
Source repository

What it does

Generates strongly-typed route classes and navigation helpers for package:go_router. It uses code generation to translate route annotations and classes into type-safe go and push extension methods, replacing string-based path parameters with strongly-typed arguments.

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

Use it when

  • You are using go_router and want compile-time type safety for route parameters.
  • You want to avoid writing manual string-based path and query parameter parsing logic.

Skip it when

  • You are not using package:go_router for navigation.
  • You prefer runtime configuration without build_runner code generation steps.

Strengths

  • Compile-time type checking for route arguments and parameters
  • Reduces navigation boilerplate like manual int.parse or parameter extraction
  • Integrated directly with go_router ecosystem

Weaknesses

  • Requires running build_runner for code generation
  • Adds build dependency overhead

Setup

Kind
Flutter widgets
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
9

Requires adding build_runner and go_router_builder to dev_dependencies and running dart run build_runner build.

class HomeRoute extends GoRouteData with $HomeRoute {
  const HomeRoute();

  @override
  Widget build(BuildContext context, GoRouterState state) => const HomeScreen();
}

Alternatives

Packages that do the same job and could replace go_router_builder.

  • auto_route

    Alternative routing solution that provides its own complete router and code generator without requiring go_router.

  • beamer

    Alternative router package focused on delegate-based navigation and syncing application state with URIs.

Works with

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