I have a login page, and after login homepage basically. The homepage has BottomNavigationBar
, like Instagram, and It's obvious that it's not GoRoute
, instead of this it's ShellRoute
. So, ShellRoute
has a key
, but it has not path
parameter, and because of this I can not use context
. go or push methods.
I supposed that ShellRoute
has a path
but it's not.
Things to keep in mind while using context.go()
from ShellRoute
to GoRoute
parentNavigatorKey
prop in each GoRoute
context.go()
to replace page , context.push()
to push page to stack
final _parentKey = GlobalKey<NavigatorState>();
final _shellKey = GlobalKey<NavigatorState>();
|_ GoRoute
|_ parentNavigatorKey = _parentKey 👈 Specify key here
|_ ShellRoute
|_ GoRoute // Needs Bottom Navigation
|_ parentNavigatorKey = _shellKey
|_ GoRoute // Needs Bottom Navigation
|_ parentNavigatorKey = _shellKey
|_ GoRoute // Full Screen which doesn't need Bottom Navigation
|_parentNavigatorKey = _parentKey
Refer detailed code and explaination of bottom NavigationBar using ShellRoute
and GoRouter
here