I receive an error in Android Studio when creating a user sign in method using FirebaseAuth and FirebaseUser. Mainly telling me to either cast or change FirebaseUser to AuthResult both of which leads to a failure to create a firebase user resulting in No implementation found for method createUserWithEmailAndPassword on channel plugins.flutter.io/firebase_auth.
I have tried the responses from Android Studio without luck. The best fix is to revert to an earlier FirebaseAuth version. I'm currently using version: firebase_auth: ^0.14.0.
FirebaseUser user = await FirebaseAuth.instance.signInWithEmailAndPassword(email: _email, password: _password);
I receive error: A value of type 'AuthResult' can't be assigned to a variable of type 'FirebaseUser'.
when using the above code.
When I change FirebaseUser
to AuthResult
or cast it as as FirebaseUser
, I receive No implementation found for method createUserWithEmailAndPassword on channel plugins.flutter.io/firebase_auth.
and it doesn't create the user in the Firebase database.
How can I use the latest version of FirebaseAuth without running into this error?
Edit: I have tried the related questions/answers on the topic to no avail including using latest SDKcompile versions.
There was a breaking change in version 0.12.0. Check the Changelog here: https://pub.dev/packages/firebase_auth#-changelog-tab-
Breaking Change. Sign-in methods now return AuthResult instead of FirebaseUser. Retrieve the FirebaseUser using the user property of AuthResult.
I haven't updated my package yet, but I imagine it would look something like this.
AuthResult result = await FirebaseAuth.instance.signInWithEmailAndPassword(email: _email, password: _password);
FirebaseUser user = result.user;
这对我有用-
AuthResult result = await FirebaseAuth.instance.signInWithEmailAndPassword(email: _email, password: _password); FirebaseUser user = result.user;
它对我来说是工作(我正在使用firebase_auth:^ 0.14.0 firebase_database:^ 3.0.5),如果它说是不必要的演员,您也可以尝试一下。
FirebaseUser user = (await _firebaseAuth.createUserWithEmailAndPassword(email: email, password: password)) as FirebaseUser;
Casting throws an error. This worked for me:
AuthResult auth = await FirebaseAuth.instance.signInWithEmailAndPassword(email: _email, password: _password);
auth.user // FIREBASE USER
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.