且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在扑翼和火场中使用不同类型的用户进行登录?

更新时间:2022-06-26 07:49:09

如果您要在登录后导航到其他页面,则类似于:

final FirebaseAuth firebaseAuth = FirebaseAuth.instance;
firebaseAuth
    .signInWithEmailAndPassword(
        email: emailController.text, password: passwordController.text)
    .then((result) {
  firestoreInstance
      .collection('Users')
      .document(usernameController.text)
      .get()
      .then((value) {
      var userType = (value.data)['userType'];
      if (userType == "firstType") {
        Navigator.pushReplacementNamed(context, '/homepage');
      }
      else if (userType == "secondType") {
        Navigator.pushReplacementNamed(context, '/anotherpage');
      }
    });
  }