不能注册用户中的火力地堡(firebase_auth/未知:null)

0

的问题

我是注册用户中的火力地堡并且每次我尝试注册它显示了我所提到的错误和不发送全权证书火力地堡. 虽然这是获得证书从火力地堡进行登录,但表示的错误,同时储存值在火力地堡. 下面是代码,只有登记册获取的电子邮件地址和密码。 我有另外一个问题,如密码和电子邮件如何我可以储存其他详细信息在火力地堡e。g年龄、性别等。 请帮我走过这一点。

class _ClientRegistrationScreenState extends State<ClientRegistrationScreen> {
  bool showSpinner = false;
  final _auth = FirebaseAuth.instance;
  File image;
  //final ImagePicker _picker = ImagePicker();
  String password;
  String confirmPassword;
  String email;
  String name;
  bool _passwordVisible = false;
  bool _confirmPasswordVisible = false;

  @override
  void initState() {

    _passwordVisible = false;
    _confirmPasswordVisible = false;
  }
  final _formKey = GlobalKey<FormState>();
  Expanded(
                    child: Center(
                      child: TextFormField(
                        validator: (value) {
                          if (value == null || value.isEmpty) {
                            return '*Email Address Required';
                          }
                          return null;
                        },
                     
                        ),
                      ),
                    ),
                  ),
                  Expanded(
                    child: Center(
                      child: TextFormField(
                        onChanged: (value){
                          password = value;
                        },
                        validator: (value) {
                          if (value == null || value.isEmpty) {
                            return '*Password Required';
                          }
                          if (password != confirmPassword) {
                            return 'Password Donot Match';
                          }
                          return null;
                        },
                        
                            onPressed: () {
                            
                              setState(() {
                                _passwordVisible = !_passwordVisible;
                              });
                            },
                          ),
                        ),
                      ),
                    ),
                  ),
                  Expanded(
                    child: Center(
                      child: TextFormField(
                        onChanged: (value){
                          confirmPassword = value;
                        },
                        validator: (value) {
                          if (value == null || value.isEmpty) {
                            return '*Confirm Password';
                          }
                          if (password != confirmPassword) {
                            return 'Password Donot Match';
                          }
                          return null;
                        },
                             onPressed: () {
                              
                              setState(() {
                                _confirmPasswordVisible = !_confirmPasswordVisible;
                              });
                            },
                          ),
                        ),
                      ),
                    ),
                  ),
                  RoundedButton(
                      colour: Colors.yellow,
                      opColour: Colors.yellow.withOpacity(0.2),
                      title: 'Register',
                      buttonTextColor: Colors.black,
                      onPressed: () async {
                        if (_formKey.currentState.validate()) {
                          setState(() {
                            showSpinner = true;
                          });
                         
                          ScaffoldMessenger.of(context).showSnackBar(
                            const SnackBar(content: Text('Processing Data')),
                          );
                        }

                        try {
                          final newUser = await _auth.createUserWithEmailAndPassword(
                              email: email, password: password);
                          if(newUser!=null){
                            Navigator.pushNamed(context, MainEmployeeScreen.id);
                            print(name);
                          }
                          setState(() {
                            showSpinner = false;
                          });
                        }
                        catch(e){
                          print(e);
                        }
                      }
                  ),
1

最好的答案

0

你有没有初始化火力地堡中的主要功能?

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}
2021-11-24 06:32:41

是的我已经被初始化了它在主
Usama Bin Tahir

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................