go_router
18.1.4, released 11 days ago by flutter.dev
Declarative routing package for Flutter based on Navigation 2 supporting deep links and URL-based navigation.
What it does
A declarative routing package for Flutter that uses the Router API to provide a convenient, URL-based API for navigating between different screens. It allows you to define URL patterns, navigate using URLs, handle deep links, and configure redirection.
AI-written summary of version 18.1.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need robust URL-based routing and deep linking support in a Flutter application.
- You want declarative navigation based on the Flutter Navigation 2 API.
- You need support for multiple navigators, sub-routes, and shell routes like bottom navigation bars.
Skip it when
- You prefer a simple imperative navigator push and pop model without URL mapping.
- The package is considered feature-complete by the Flutter team and you require active core feature additions.
Strengths
- Built-in URL path and query parameter parsing using template syntax.
- Comprehensive deep linking support across platforms.
- Redirection support based on application state (e.g. authentication).
Weaknesses
- Active feature development is not currently planned as the package is considered feature-complete by the Flutter team.
- Navigation 2 abstractions can have a steep learning curve.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
not documented
final GoRouter _router = GoRouter(
routes: <RouteBase>[
GoRoute(
path: '/',
builder: (BuildContext context, GoRouterState state) {
return const HomeScreen();
},
routes: <RouteBase>[
GoRoute(
path: 'details',
builder: (BuildContext context, GoRouterState state) {
return const DetailsScreen();
},
),
],
),
],
);Alternatives
Packages that do the same job and could replace go_router.
- auto_route
Pick auto_route if you prefer code generation for strongly-typed arguments and routes.
87Compare - beamer
Pick beamer if you want location-based routing that synchronizes your app state with the browser URL.
50Compare
Works with
Packages commonly used together with go_router: ones it builds on, ones built on it, and its own family.
- logginggo_router depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- material_uigo_router depends on itOfficial Flutter Material UI library implementing Google’s Material Design system.
- cupertino_uigo_router depends on itOfficial Flutter Cupertino design library implementing Apple HIG iOS and macOS user interfaces.
- google_fontsSame familyFlutter package to load Google Fonts at runtime or bundle them as assets
- animationsSame familyFancy pre-built animations that can easily be integrated into any Flutter application.
- go_router_builderSame familyA code generator for type-safe route helpers and definitions with package:go_router.
- rfwSame familyRenders declarative widget description files at runtime for Remote Flutter Widgets.
- newrelic_mobileBuilt on go_routerFlutter plugin to send app telemetry to New Relic Mobile