-
-
Notifications
You must be signed in to change notification settings - Fork 205
Custom Objects and Pointers to a CustomObject #287
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
Hey
It is a slight annoyance that this happens. It's mainly due to the lack of
reflection in Flutter. I don't think there is a better version of this
right now.
…On Sat, Nov 9, 2019, 21:09 buckettt ***@***.***> wrote:
I have a Custom Object (Activity) that I want to have a Pointer to another
Custom Object (Spot).
I retrieve it as follows.
queryBuilder = QueryBuilder<Activity>(Activity())
..orderByDescending("createdAt")
..includeObject([
"mySpot", //this is the pointer
])
This works fine however mySpot is as a ParseObject whereas what I need is
ParseObject as a CutomObject.
However when I setup my getter/setter for mySpot as a custom object as
below
class Activity extends ParseObject implements ParseCloneable {
...
static const String _keyTableName = 'Activity';
static const String _keySpot = 'mySpot';
Spot get myspot => get<Spot>(_keySpot) as Spot;
set myspot(Spot s) => set<Spot>(_keySpot, s);
}
I get an error:
type 'ParseObject' is not a subtype of type 'Spot' in type cast
Whats the best way to cast a pointer to a custom object? Or is there a
better way of doing this?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#287?email_source=notifications&email_token=AB4CPXVSATLDL6W63USJXC3QS4RI3A5CNFSM4JLJSOA2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HYGNKTA>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4CPXTZFGETIUXC2LFT6LTQS4RI3ANCNFSM4JLJSOAQ>
.
|
OK thanks, I guess that means it is impossible then? |
It's not impossible. How are you accessing it at the moment. Do you have a
list of 'mySpot' or just a single object. Usually single objects are fine.
It's mainly when returning a list that we found a struggle
…On Sun, Nov 10, 2019, 08:49 buckettt ***@***.***> wrote:
OK thanks, I guess that means it is impossible then?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#287?email_source=notifications&email_token=AB4CPXXMLIQVUQG2G3EXI63QS7DJ7A5CNFSM4JLJSOA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDUYNRY#issuecomment-552175303>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4CPXR7BIVDVMLWPDUT6X3QS7DJ7ANCNFSM4JLJSOAQ>
.
|
'mySpot' is just a pointer to a single object. I'm accessing it using the query above then simply doing:
} |
Yes, I see the issue. The problem is the list. The best thing to do is
create an empty list containing mySpot and iterate through the response
list and cast them individually. We don't have a fix for this right now but
hopefully will shortly.
…On Sun, Nov 10, 2019, 09:28 buckettt ***@***.***> wrote:
'mySpot' is just a pointer to a single object. I'm accessing it using the
query above then simply doing:
var response = await queryBuilder.query();
if (response.success) {
var a = response.results[0].myspot;
}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#287?email_source=notifications&email_token=AB4CPXUTGG7KPBDH7Y7QTC3QS7H47A5CNFSM4JLJSOA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDUZCEQ#issuecomment-552177938>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4CPXRFEFN5UU4ZZS6O6FLQS7H47ANCNFSM4JLJSOAQ>
.
|
No problem, thanks for your help. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a Custom Object (Activity) that I want to have a Pointer to another Custom Object (Spot).
I retrieve it as follows.
This works fine however mySpot is as a ParseObject whereas what I need is ParseObject as a CutomObject.
However when I setup my getter/setter for mySpot as a custom object as below
I get an error:
type 'ParseObject' is not a subtype of type 'Spot' in type cast
Whats the best way to cast a pointer to a custom object? Or is there a better way of doing this?
Edit: Spot extends ParseObject
The text was updated successfully, but these errors were encountered: