Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

navigatorKey: Get.key Causes "GetRoot is not part of the tree" Exception in GetMaterialApp #3323

Open
wheadali opened this issue Mar 2, 2025 · 1 comment
Assignees

Comments

@wheadali
Copy link

wheadali commented Mar 2, 2025

When setting navigatorKey: Get.key inside GetMaterialApp, the following exception occurs at runtime:
'''
Exception: GetRoot is not part of the tree
The relevant error-causing widget was: Builder(dirty)
'''
This issue disappears when navigatorKey: Get.key is removed. It seems that Get.key is not initialized correctly before being used in GetMaterialApp, leading to a navigation-related failure.

Steps to Reproduce:
Use navigatorKey: Get.key in GetMaterialApp.
Run the app.
The exception occurs immediately.
Expected Behavior:
navigatorKey: Get.key should work without causing the exception, ensuring smooth navigation handling.

Environment:
Flutter version: 3.24.3
GetX version:^5.0.0-release-candidate-9.2.1
Dart version: 3.5.3
Device/Platform: Android
Possible Workaround:
Using a manually created GlobalKey instead of Get.key resolves the issue. However, this should not be necessary when using GetX's built-in navigation system.

@lxgogogo
Copy link

same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants