Home > database >  I have a problem creating a user using the firebase, FirebaseAuth
I have a problem creating a user using the firebase, FirebaseAuth

Time:04-23

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)

enter image description here

  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:

  1. stop the app enter image description here
  2. run the app again

Hope it helps!

  • Related