更新时间: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');
}
});
}