A declarative, URL-based router for Flutter
open sourceBSD-3-Clausefree
go_router is the Flutter team's routing package: it builds on Flutter's Router API so an app defines its screens as URL patterns, navigates by URL and handles deep links. Routes take path and query parameters from templates such as user/:id, can nest sub-routes, redirect based on app state (to a sign-in screen when the user isn't signed in, for example), and ShellRoute keeps an inner navigator such as a bottom navigation bar on screen while the pages inside it change. It works with Material and Cupertino apps and alongside the older Navigator API. The Flutter team considers it feature-complete and focuses on bug fixes and stability. It's part of the flutter/packages repository and published on pub.dev by flutter.dev.
Problems it solves
- navigate between screens in my Flutter app using URLs instead of pushing routes by hand
- handle deep links that open a specific screen in a Flutter app
- send users to the sign-in screen when they aren't logged in before showing a page
- keep a bottom navigation bar on screen while the pages inside it change
- parse path and query parameters like /user/:id from the URL in Flutter
- make the browser URL and back button work in a Flutter web app
Features
- Routes defined as URL patterns with path and query parameters
- Nested sub-routes
- Redirects based on app state
- ShellRoute for an inner navigator such as a persistent bottom navigation bar
- Works with Material and Cupertino apps
- Type-safe routes, named routes, transition animations and state restoration
- Android, iOS, Linux, macOS, web and Windows
Alternatives
The same job
These do what go_router does.
- go_router_builder Generates strongly typed route helpers for go_router
