8000 FlutterError ShortcutRegistry in cascading_menu_page.dart in Context_Menus · Issue #2590 · flutter/samples · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

FlutterError ShortcutRegistry in cascading_menu_page.dart in Context_Menus #2590

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

Open
RequieMa opened this issue Feb 24, 2025 · 2 comments
Open

Comments

@RequieMa
Copy link

Exception has occurred.
FlutterError (ShortcutRegistry: Received a duplicate registration for the shortcut SingleActivator#39312(keys: Control + Key S) in ShortcutRegistryEntry#64d8f and Instance of 'ShortcutRegistryEntry'.)

Image

@RequieMa
Copy link
Author

I found steps to constantly reproduce this issue:

  1. Run the flutter app in debug mode using vscode
  2. Select Cascading
  3. Right click to show the menu list
  4. Right click again

It seems to be some problem with the dispose method
Image
with the original code, if I right clicked twice, the ShortcutRegistry.of(context) did not dispose properly, and the same shortcuts were added again. That caused the problem

Image
If I verify the length before adding the shortcuts, the problem solved. However, it seems to be a workaround, I did not understand why the dispose did not work properly.

What do you think about this solution? If it is good enough, I will push a merge request

@parlough
Copy link
Member

Thanks for reporting and investigating the issue!

@justinmc Could you take a look at this issue and the proposed solution? I appreciate the help :)

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

2 participants
0