-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Revise and improve cached factory handling with params #387
Revise and improve cached factory handling with params #387
Conversation
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.
LGTM!
@samirsimnica just curious, why could you approve this PR? |
test/get_it_test.dart
Outdated
constructorCounter++; | ||
} | ||
|
||
void dispose() { |
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 think you don't use the dispose
in your test so the linter complains and the CI can't run.
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 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 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.