furaiev / amazon-cognito-identity-dart-2

Unofficial Amazon Cognito Identity Provider Dart SDK, to easily add user sign-up and sign-in to your mobile and web apps with AWS.
MIT License
187 stars 114 forks source link

getSession is called on nul #45

Closed kebsont closed 4 years ago

kebsont commented 4 years ago

Hello, When I try to get the currentUser() from Page to Page I got this error.

flutter: The error; flutter: NoSuchMethodError: The method 'getSession' was called on null.

Receiver: null

Here my code

Future<UserService> _getValues() async {
    try {
      final user = await userPoolSettings.getCurrentUser();
      final session = await user.getSession();
      print(session);
    } catch (e) {
      print("The error; ");
      print(e);
    }
    return _userService;
  }

My userPool definition is like this, with great credentials

  static final userPoolSettings = new CognitoUserPool(
     xxxxxxxxx, xxxxxx);
furaiev commented 4 years ago

@kebsont sorry for the long reply, Have you managed to fix the issue?

kebsont commented 4 years ago

Hello @furaiev , no I finally changed and used another technologie.

furaiev commented 4 years ago

Ok, then I close this issue.