Summary
When building multi-screen apps, especially for the web, managing navigation in Flutter can quickly become complex. From keeping your app's UI in sync with the browser's URL bar to managing deep links, authentication flows, and dynamic layouts — traditional Navigator
and Route
handling often fall short in providing a clean, scalable solution.
That’s where go_router
steps in.
Developed by the Flutter team itself, go_router
is now an official package endorsed and maintained by the Flutter team. It addresses common navigation challenges by providing:
As Flutter apps scale up with more screens, complex states, and varying navigation patterns (like tabs and drawers), go_router
helps you write cleaner and more predictable routing logic. It was designed to offer the Flutter-style declarative approach with the web-style navigation feel, making it an essential tool for modern Flutter development.
To get started with go_router
, refer to the official documentation for understanding the concepts and learning the basics of Configuration and Navigation.
In this blog, we go beyond the basics — diving into how go_router
can be harnessed to build sophisticated navigation setups with app bars, bottom nav bars, deep links, and more — all while keeping your code manageable and your routes meaningful.
Let’s say you’re building a typical multi-screen Flutter web app. You want to create a persistent AppBar
at the top and a BottomNavigationBar
at the bottom — or possibly just one of them. When the user taps a tab, only the main content should update — not the AppBar
or the BottomNavigationBar
.
Sounds simple, right?
Let’s look at two videos — one using basic go_router
and the other using the ShellRoute
class in go_router
.
Sounds simple, right?
Let us check out these two videos, one with simple go_router
and one with go_router
ShellRoute class.
go_router
)There are three screens — Home, Settings, and Search. Each of these screens has its own AppBar
and BottomNavigationBar
.