检查用户是否登录Flutter& firebase验证| [英] Check if the user is logged in Flutter & firebase auth |

查看:147
本文介绍了检查用户是否登录Flutter& firebase验证|的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Firebase身份验证对我的Flutter应用程序中的用户进行身份验证,当用户输入正确的密码时,该应用程序会正常向他显示主页,但是当密码输入错误时什么也没发生,我想显示一个警报每次用户输入错误的密码,该怎么办?

I'm using firebase authentication to authenticate users in my Flutter app ,when the user entered his right password the app shows him the home page normally but when the password is wrong doesn't happened nothing, I want to show an alert every time the user enters a wrong password, How can I do this?

推荐答案

使用 currentUser()方法:

if (await FirebaseAuth.instance.currentUser() != null) {
    // signed in
} else {

}

这篇关于检查用户是否登录Flutter& firebase验证|的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆