-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
Add scopeName parameter to popScope #292
Conversation
I know that it's been a long time, but I had to make a longer break due to health issues. |
In the beginning, I named the method I'm happy to refactor the proposed implementation. Which method name would you prefer? Should we go with |
Yeah, I think disposeScope makes sense because it is probably called because people want to dispose of all objects in it. |
thinking a bit more (toilet break :-) ) |
It would be awesome if you also could add the new function to the |
I extracted the functionality into |
It looks like tests are failing because throwsA(const TypeMatcher<AssertionError>()), with throwsA(const TypeMatcher<StateError>()), I'm happy to raise additional PR with the fix if needed. |
Thanks a lot for this PR |
Included in just pushed V7.5.0 |
Thank you! |
thanks to your PR I now could finally make pushScope in the get_it_mixin more secure https://github.com/escamoteur/get_it_mixin/blob/master/CHANGELOG.md#420---22032023 |
We use functionality similar to |
Let's imagine an object (it could be a complex stateful widget, a page, or an anchor in AR) that has complex internal dependencies (object-scoped services, repositories, etc.). I found it highly convenient to push a separate named scope during this object creation and lazily initialize its dependencies. The problem is that, when the object dies, I cannot remove the scope without popping scopes that potentially were pushed on top of it, i.e. it is not possible to drop the scope B without dropping scope C as well:
With this PR I propose adding functionality that allows dropping any named scope from the stack.