I did the authentication, but when I click to create an account it throws an error:
MissingPluginException(No implementation found for method createUserWithEmailAndPassword on channel plugins.flutter.io/firebase_auth)
final _auth = FirebaseAuth.instance;
void _submitAuthForm(String email, String user, String pass, bool isLogin , context) async {
AuthResult authResult;
try {
if (isLogin) {
authResult = await _auth.signInWithEmailAndPassword(
email: email, password: pass);
} else {
authResult = await _auth.createUserWithEmailAndPassword(
email: email, password: pass);
}
} on PlatformException catch (err) {
var errorMessage = 'An error ocurred. Please check your credentials.';
if (err.message != null) {
errorMessage = err.message!;
}
showDialog(
context: context,
builder: (context) => AlertDialog(
content: Text(errorMessage),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text('OK'),
),
],
),
);
} catch (error) {
print(error);
}
}
CodePudding user response:
Make sure you have enabled Sign-in with Email/Password in Firebase Console. Also, try updating packages to the latest version. Along with that do upgrade your flutter version as well. Once you did all that, try running flutter clean and re-running your project. Cheers!! Hope it works.
CodePudding user response:
Solution:
Hope it helps!