如何从Firebase获取用户名

时间:2020-06-16 06:09:46

标签: firebase flutter dart

如何从Firebase获取currentUser的详细信息? (使用Firebase中的数据填充占位符。)

我想获取currentUser的displayName和电子邮件,并用Placeholder1(用户名),Placeholder2(login@comapany.com)替换

 new UserAccountsDrawerHeader(
          accountName: new Text(
            "User name",//Placeholder 1
            style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15.0),
          ),
          accountEmail: new Text(
            "login@company.com", //Placeholder 2
            style: TextStyle(
                fontStyle: FontStyle.italic,
                fontSize: 14.0,
                color: Color(0xFFDEB992)),
          ),

1 个答案:

答案 0 :(得分:0)

创建方法template<class T> void insert_differences(T& container) { for(auto it : container){ // do some operations here //advance(it,1); it = next(it); // do some operations here //advance(it, -1); it = prev(it); } }

getUserData()

然后使用Future<AuthResult> getUserData() async{ return await FirebaseAuth.instance.currentUser(); } 显示FutureBuilderemail