Skip to content

NoSuchMethodError: Class 'ParseObject' has no instance method '[]'. #114

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

Closed
pcg92 opened this issue Mar 12, 2019 · 8 comments
Closed

NoSuchMethodError: Class 'ParseObject' has no instance method '[]'. #114

pcg92 opened this issue Mar 12, 2019 · 8 comments

Comments

@pcg92
Copy link
Contributor

pcg92 commented Mar 12, 2019

I have a problem checking if there are a current user.

Steps to reproduce:
1º Sign in a user
2º Close the app
3º Check for user = error

E/flutter (25299): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: Class 'ParseObject' has no instance method '[]'.
E/flutter (25299): Receiver: Instance of 'ParseObject'
E/flutter (25299): Tried calling: []("sessionToken")

parse_user.dart:377:45)

      if (userMap != null) {
        ParseCoreData().setSessionId(userMap[keyParamSessionToken]);

Any idea?

@pcg92 pcg92 closed this as completed Mar 12, 2019
@pcg92 pcg92 reopened this Mar 12, 2019
@phillwiggins
Copy link
Member

If I'm correct, we don't have a SessionToken until speaking to the API?

The logic would be something like

final ParseUser user = await ParseUser.getCurrrentUser();
user.login();

This would give you a registered user with a sessionToken

@pcg92
Copy link
Contributor Author

pcg92 commented Mar 12, 2019

This my userJson:
{\"__type\":\"Pointer\",\"className\":\"_User\",\"objectId\":\"6uQJiVDr9t\"}

Im doing "loginWith" google

So the error is obvious:

 if (userJson != null) {
      var userMap = parseDecode(json.decode(userJson));

      if (userMap != null) {
        ParseCoreData().setSessionId(userMap[keyParamSessionToken]);
        return _getEmptyUser()..fromJson(userMap);
      }
    }

@phillwiggins
Copy link
Member

phillwiggins commented Mar 12, 2019 via email

@pcg92
Copy link
Contributor Author

pcg92 commented Mar 12, 2019

Could be that loginWith is storing the pointer instead the full object?

@phillwiggins
Copy link
Member

phillwiggins commented Mar 12, 2019 via email

@pcg92
Copy link
Contributor Author

pcg92 commented Mar 12, 2019

Im using the latest and 1.0.15.

@phillwiggins
Copy link
Member

phillwiggins commented Mar 12, 2019 via email

@pcg92
Copy link
Contributor Author

pcg92 commented Mar 12, 2019

Im going to close this issue, probably was a problem with my cache of the dependencies, now Its running ok (1.0.15)

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

No branches or pull requests

2 participants