【发布时间】:2020-09-01 09:30:46
【问题描述】:
我使用 MongoDB 在颤振中创建了一个登录页面,当用户输入有效凭据时,他们必须导航到主页,否则他们应该留在同一页面。如何实现这个逻辑?
当他们输入有效凭据时,我可以在控制台中成功打印用户,但如果是 isLogin = true,我如何导航到下一页?
Future<String> signIn() async {
final response = await http.post(
serverReceiverPath,
headers: {'Content-Type': 'application/json'},
);
if(response.body == 'Login successful'){
isLogin = true;
}else{
isLogin = false;
}
print(response.body);
print(isLogin);
}
【问题讨论】: