coding-with-flutter-login-demo icon indicating copy to clipboard operation
coding-with-flutter-login-demo copied to clipboard

When upgrading to latest Auth

Open jamiethain opened this issue 5 years ago • 0 comments

Greetings,

The latest auth package is 0.14.0+5.

This is required as some of the newer packages like storage is 3.0.6 requires a newer auth.

When you upgrade to that version of the auth package, the lines no longer work.


 Future<String> signInWithEmailAndPassword(String email, String password) async {
    final FirebaseUser user = await _firebaseAuth.signInWithEmailAndPassword(email: email, password: password);
 
    return user?.uid;
  }

The _firebaseAuth.signIn... now returns a different type, of AuthResult.

So I changed the code to be, (as a guess)


 Future<String> signInWithEmailAndPassword(String email, String password) async {
    final AuthResult auth = await _firebaseAuth.signInWithEmailAndPassword(email: email, password: password);
    final FirebaseUser user = auth.user; 
    return user?.uid;
  }


My new update actually doesn't log on and gets an error of casting from Null.

Any ideas?

jamiethain avatar Sep 09 '19 20:09 jamiethain