Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ArtAhmetajCR
Copy link

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:

if (weakReferenceInstance?.target != null &&
              param1 == lastParam1 &&
              param2 == lastParam2)

Saving the lastParams when creating new instances fixes this.

Appropriate tests have been writen for the cached factory which were entirely missing earlier.

Copy link

@samirsimnica samirsimnica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@escamoteur
Copy link
Member

@samirsimnica just curious, why could you approve this PR?

constructorCounter++;
}

void dispose() {
Copy link
Member

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.

Copy link
Author

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.

@escamoteur escamoteur merged commit d9f7485 into flutter-it:master Oct 28, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

4 participants