-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
Labels
frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Description
Simple use case
On each named route in your app, you have a single Scaffold that contains a given static GlobalKey, so no matter which route you land on, you can access that given Scaffold using said GlobalKey (relevant for showing snackbars for example).
However when navigating using named routes, flutter throws the "Duplicate GlobalKey" error.
Steps to Reproduce
I've made an extremely simple example of the problem, using two named routes, that navigate to the same Scaffold that shows the counter from the default flutter project.
git clone github.com/larssn/flutter-globalkey-navigatorflutter run- Click either the "Route1" or "Route2" button.
Duplicate GlobalKey error happens.
(Navigation looks like this: https://github.com/larssn/flutter-globalkey-navigator/blob/master/lib/main.dart#L115)
Logs
Logs probably aren't relevant, but let me know if you want them.
Analyzing navtest...
No issues found! (ran in 5.9s)
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.13.6 17G6030, locale en-DK)
• Flutter version 1.5.4-hotfix.2 at /Users/larsstoettrup/workspace/flutter
• Framework revision 7a4c33425d (3 weeks ago), 2019-04-29 11:05:24 -0700
• Engine revision 52c7a1e849
• Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/larsstoettrup/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Users/larsstoettrup/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
• ios-deploy 1.9.4
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 35.3.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] VS Code (version 1.34.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.0.2
[✓] Connected device (1 available)
• SM T580 • 52037c6b4d72c351 • android-arm • Android 8.1.0 (API 27)
Metadata
Metadata
Assignees
Labels
frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.