-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: access to defined scope #17
Conversation
Deploying flutter-disco with
|
Latest commit: |
d6c4392
|
Status: | ✅ Deploy successful! |
Preview URL: | https://1aceb0b9.flutter-disco.pages.dev |
Branch Preview URL: | https://feat-access-to-scope.flutter-disco.pages.dev |
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## main #17 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 9 9
Lines 215 215
=========================================
Hits 215 215
|
// cannot be late | ||
// ignore: use_late_for_private_fields_and_variables | ||
ProviderScopeState? _scopeState; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not like the ProviderScopeState? _scopeState
that is here (and the one in ArgProvider
). Can we do this differently, somehow? I am confident we should keep our providers immutable.
I am pretty sure the ProviderScopeState? _scopeState
introduces bugs. Remember the one we had with ArgProvider
when replacing keys? I am fearing something similar here...
ProviderScope
should handle the logic. If it is not possible to move it there, then I would rather close this without merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I didn't know about deactivate.
Before the problem, when the key of ProviderScope change, was that the dispose was called after initState. But deactivate is called before.
I think I can refactor the business logic again (in another PR) and make it working removing many models and keeping the logic pretty simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The immutability bring no value here. There are just variables with a value assigned, they are still final. (Immutable)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW: all tests are passing, including the key change which I tested manually
💩 |
Allow providers to access the scope where they are defined.
This now it totally feasible
This removes the boilerplate of using two nested ProviderScope widgets