Fluter GoRouter — The Complete Crash Course

Tomic Riedel
3 min readAug 29, 2022

go_router is a very popular routing solution, that makes Flutters Navigator 2.0 easy again. In this article, you will learn how to use it and will see, how easy it is to use. Let’s get started!

Happy reading!

Note: You can find the whole source code provided in this tutorial here

Installation

The first thing we have to do after creating our app is to add go_router. To do so, we will use the command flutter pub add go_router. You should be familiar with those commands, otherwise, I recommend you to look up the basics of Flutter again.

Getting started

The first thing we have to create is a variable of Type GoRouter. We will store all routes there:

Now, instead of writing a plain MaterialApp, we will use MaterialApp.router. There we can customize settings for routes and still use the features of MaterialApp. Inside the MaterialApp.router, we set routeInformationProvider to _router.routeInformationProvider, routeInformationParser to _router.routeInformationParser and routerDelegate to _router.routerDelegate. As you can see, GoRouter…

--

--

Tomic Riedel

Sharing the process of building a portfolio of apps to make people more productive.