-
-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Unable to cast nested custom object #237
Comments
I msged before and it seems it is expected. My work around is have my MotherObject mixed the Cache and use a utility for get. (not sure whey github automatically strikes some texts). MotherClass implements HasCache { typedef S Constructor static T getParseObject(
} |
Thank @gorillatapstudio for the workaround. @phillwiggins : What do you think about of making this workaround as default in the lib? Or you have another idea to handle this case more cleanly? |
the string conversion in my workaround is not efficient. Hope @phillwiggins can support get(key) directly in the sdk and convert directly. |
Hey @manhhavu & @gorillatapstudio Unfortunately, I'm doing something similar. In my classes, I do something like this in my Parse class.
The issue is that Flutter doesn't support reflection, and based on best practices, when we actually convert our JSON to a returnable object, we define that the return type is ParseObject. Even using generics we haven't found a better approach to this. The approach above works well too, but my approach is the reason you will see that ParseObjects implement the cloneable method. |
Hi,
It seems that when a class' field is custom object, the SDK is currently unable to cast the correct type to the nested object with an error 'type 'ParseObject' is not a subtype of type '''.
Version: 1.0.22 (same problem with older versions : 1.0.21, 1.0.19)
I don't know if it is expected and is there any workaround for that? I have a lot of nested custom objects to update so using the raw method set(key, value) is very cumbersome.
Thanks for your help,
The text was updated successfully, but these errors were encountered: