-
-
Notifications
You must be signed in to change notification settings - Fork 153
registerFactoryParam does not allow subclasses for param types? #62
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
Comments
Got the same issue while using https://pub.dev/packages/freezed. |
I probably should use |
Same with https://pub.dev/packages/built_value:
param1 == null || param1 is P1 seems to work fine |
I have the same problem, maybe the suggestion above should be included in a next version |
@escamoteur replacing |
@votruk I tried it and it didn't work because if it works for you I really would like to know how. |
Next version has this test removed because of limitation of Dart |
@escamoteur It looks like for asynchronous factories this issue still exists in newest 5.0.4 version. I got it when using registerFactoryParamAsync. |
could you add a small test in a PR? |
Sorry for the late reply |
Forget it, I found the problem |
Fixed in V5.0.6 |
It looks like
registerFactoryParam()
does not allow invocation of the factory function in which one of the parameters is an object that is a subclass of the defined parameter type. Is my understanding correct, and is this expected behavior? Should I be using some other method instead?For instance, I register my factory like so:
PackStore
is a simple class that is extended byPackStoreModel
, and an instance of the latter is passed to the factory method, at which point I get this error:Thanks
The text was updated successfully, but these errors were encountered: