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.
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.
87Compare - beamer
Alternative router package focused on delegate-based navigation and syncing application state with URIs.
50Compare
Works with
Packages commonly used together with go_router_builder: ones it builds on, ones built on it, and its own family.
- analyzergo_router_builder depends on itPerforms static analysis of Dart code for tool integration and embedding.
- asyncgo_router_builder depends on itUtility classes and helpers that extend Dart's async library.
- buildgo_router_builder depends on itPackage for authoring build_runner compatible code generators.
- build_configgo_router_builder depends on itFormat definition and support for parsing build.yaml configuration.
- source_gengo_router_builder depends on itSource code generation builders and utilities for the Dart build system.
- source_helpergo_router_builder depends on itUtilities to help with Dart source code generation and string literal formatting.
- build_runnerUsed togetherA build system for Dart code generation and modular compilation.
- go_routerSame familyDeclarative routing package for Flutter based on Navigation 2 supporting deep links and URL-based navigation.