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

[feature]: ability to unregister dialogs #1119

Closed
WinXaito opened this issue Aug 19, 2024 · 3 comments
Closed

[feature]: ability to unregister dialogs #1119

WinXaito opened this issue Aug 19, 2024 · 3 comments

Comments

@WinXaito
Copy link

Is your feature request related to a problem? Please describe.

In m'y application, I use a "FeatureSystem", it means I can activate or deactivate some functionalities with a license. (it's a little like a plugin system, but the code loading is not dynamic, because of dart).

Some of the functionalities use dialogs. So I'm able to register these dialogs when the package is initialised, but I have no way to unregister them when I dispose my package.

Describe the solution you would like

It would be cool if we can have a method like unregisterCustomDialogBuilders(List<dynamic>) here: https://github.com/Stacked-Org/services/blob/main/lib/src/dialog/dialog_service.dart#L25

Additional Context

No response

@WinXaito WinXaito changed the title [feature]: [feature]: ability to unregister dialogs Aug 19, 2024
@FilledStacks
Copy link
Contributor

@WinXaito Dos leaving them there cause any issues.

I like the idea of unregistering, but I'm wondering if the same functionality can't be achieved simply by not calling the showDialog function for that variant

@WinXaito
Copy link
Author

Sorry for the delayed answer.

Yeah, at this time, I don't unregister them and that works fine.

I was wondering if it could be an issue if I register multiple time the same dialog?

In my software, I have a "features" system. Unlike standard plugin (as it is not possible with dart). All my feature are in my soft, but some can be enabled/disabled by a license or by the user itself. So, a feature can be enabled/disabled multiple time and the enabling action will call registerCustomDialogBuilders with the dialog used by the feature.

@FilledStacks
Copy link
Contributor

@WinXaito yes that would not be an issue, the dialog would be overwritten with the new registration since we use a map to track the dialogs.

So if you register for the same enum twice, you'll have the last dialogFunction called when showing a dialog for that enum

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