ไม่สามารถลงทะเบียนผู้ใช้ใน firebase(firebase_auth/ไม่รู้จัก:โพรโทคอล aimcomment)

0

คำถาม

ฉันลงทะเบียนผู้ใช้ใน firebase และแต่ละครั้งที่ฉันพยายามที่จะสะท้อนมันจะแสดงให้ฉันพูดถึงข้อผิดพลาดและ donot ส่งบัตรที่ firebase. ถึงแม้ว่ามันเป็นไปเอาบัตรมาจาก firebase สำหรับการล็อกอินแต่แสดงถึงเกิดข้อผิดพลาดขึ้นระหว่างจัดเก็บค่าใน firebase. ด้านล่างนี้เป็นรหัสสำหรับเพียงเครื่องจ่ายเงินนั้นกำลังกาที่อยู่อีเมลและรหัสผ่าน ผมมีอีกคำถามนั้นเหมือนรหัสผ่านและอีเมลได้ยังไงฉันร้านขายอีกรายละเอียดใน firebase e.จีอายุเพศเป็นต้น ยินดีช่วยฉันผ่านเรื่องนี้

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

คุณเริ่มการใช้งาน firebase อยู่ในหลักฟังก์ชัน?

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ý
..................................................................................................................

ดังอยู่ในนี้หมวดหมู่

ดังคำถามอยู่ในนี้หมวดหมู่