Undefined class 'FirebaseUser'

后端 未结 4 1691
野趣味
野趣味 2020-11-22 10:06

I\'m new to Flutter. I have an Issue with Firebase Auth/ Google Auth The FirebaseUser is not defined Code:

FirebaseAuth _aut         


        
4条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 10:35

    This can be your signin function with email and password as of Sept 2020.Initialze app is a new introduced method we must at least call once before we use any other firebase methods.

     Future signin() async {
        final formState = _formkey.currentState;
        await Firebase.initializeApp();
        if (formState.validate()) {
          setState(() {
            loading = true;
          });
          formState.save();
          try {
            print(email);
            final User user = (await FirebaseAuth.instance
                    .signInWithEmailAndPassword(email: email, password: password))
                .user;
          } catch (e) {
            print(e.message);
            setState(() {
              loading = false;
            });
          }
        }
      }
    

提交回复
热议问题