Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase 如何在textfield-flatterweb中设置错误消息_Firebase_Flutter_Firebase Authentication_Textfield_Flutter Web - Fatal编程技术网

Firebase 如何在textfield-flatterweb中设置错误消息

Firebase 如何在textfield-flatterweb中设置错误消息,firebase,flutter,firebase-authentication,textfield,flutter-web,Firebase,Flutter,Firebase Authentication,Textfield,Flutter Web,我正在Flitter中构建我的web应用程序的注册屏幕,我正在使用firebase auth注册用户。如果firebase返回任何错误,我想在textfield中设置错误消息 这是我的密码 Form( key: _formKey, child: Column( children: [ TextFormField( onChanged: (value) { name = value;

我正在Flitter中构建我的web应用程序的注册屏幕,我正在使用firebase auth注册用户。如果firebase返回任何错误,我想在textfield中设置错误消息

这是我的密码

Form(
      key: _formKey,
      child: Column(
        children: [
          TextFormField(
            onChanged: (value) {
              name = value;
            },
          ),
          TextFormField(
            onChanged: (value) {
              email = value;
            },
          ),
          TextFormField(
            onChanged: (value) {
              password = value;
            },
          ),
          Container(
            child: ElevatedButton(
              onPressed: () async {
                if (_formKey.currentState.validate()) {
                   try {
                         UserCredential userCredential = await FirebaseAuth.instance
                        .createUserWithEmailAndPassword(email: email, password: password);
                      } on FirebaseAuthException catch (e) {
                        print(e.code.toString());
                      } catch (e) {
                         print(e);
                         print(e.toString());
                       }
                }
              },
              child: Text('Create an Account'),
            ),
          ),
        ],
      ),
    ),

我建议查看官方文件中的指南: