Revise and improve cached factory handling with params#387
Merged
escamoteur merged 5 commits intoflutter-it:masterfrom Oct 28, 2024
Merged
Revise and improve cached factory handling with params#387escamoteur merged 5 commits intoflutter-it:masterfrom
escamoteur merged 5 commits intoflutter-it:masterfrom
Conversation
Member
|
@samirsimnica just curious, why could you approve this PR? |
escamoteur
reviewed
Oct 27, 2024
escamoteur
approved these changes
Oct 28, 2024
escamoteur
requested changes
Oct 28, 2024
test/get_it_test.dart
Outdated
| constructorCounter++; | ||
| } | ||
|
|
||
| void dispose() { |
Member
There was a problem hiding this comment.
I think you don't use the dispose in your test so the linter complains and the CI can't run.
Author
There was a problem hiding this comment.
I have removed the method given that its not used on the test class atm, added it for consistency since it was on other classes but I dont use dispose counter to assert anything atm, if you want I can add it with your guidance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pr references issue #382 where an assertion on the getObject method (and its async equivalent) blocks cached factories from having parameters passed.
The fix is adjusting the assertion to include the "cachedFactory" as a type.
While fixing this issue I also noticed that the lastParameters were not being saved in the cached factory section, which resulted in the cached factory functions being broken since this check always failed:
Saving the lastParams when creating new instances fixes this.
Appropriate tests have been writen for the cached factory which were entirely missing earlier.