bizz84 / nested-navigation-demo-flutter

Nested navigation with BottomNavigationBar
https://codewithandrea.com/
MIT License
616 stars 139 forks source link

Help : GlobalKey<NavigatorState> was used multiple times error. #5

Closed volkangurol closed 3 years ago

volkangurol commented 5 years ago

Thanks for great example @bizz84 . I used in my projects without any problem so far. But i stuck in one point. If you can help, i really appreciate it. I wanted to integrate Firebase Analytics in my project to logging events.

static FirebaseAnalytics analytics = FirebaseAnalytics(); static FirebaseAnalyticsObserver observer = FirebaseAnalyticsObserver(analytics: analytics);

In MaterialApp i put observer, I reliazed that analytics not logging. If i remove tabbar completely it works. Then i found that if i pass observer param to Navigator page you defined, it works for first page but when i switch between tabs i get GlobalKey used multiple times error.

How can we call GlobalKey once ?

Screen Shot 2019-06-09 at 08 01 21
Shanmukhabhargav commented 3 years ago

Hi @volkangurol need to place the observer in the topmost MaterialApp and that will help to reduce the issue of generating the GlobalKey for multiple times.

volkangurol commented 3 years ago

Hi @volkangurol need to place the observer in the topmost MaterialApp and that will help to reduce the issue of generating the GlobalKey for multiple times.

Thanks this was an old issue. I switched to cupertinopagescaffold and as you stated, defined global key in the top most solved my issue