如何将特定用户连接到特定产品

时间:2019-04-28 09:48:36

标签: firebase flutter firebase-authentication

我的产品类别包含

import React from 'react';
import ReactDOM from 'react-dom';

const App = () =>{
  return <div>
    <ul>
      <li>This is jeff</li>
      <li>This is not Jeef</li>
      <li>This is Joe</li>
    </ul>;
  </div>;
};

ReactDOM.render(<App />,document.querySelector('#root'));

我也使用google登录方法,最终返回了以下内容:

 String id;
  String address;
  String image;
  bool isFavourite;
  String userEmail;

如何将特定用户连接到特定产品?

例如这种方法:

  FirebaseUser user = await _auth.signInWithCredential(credential);
    print(user.displayName);
    return user;

我希望在这里得到3个参数,当前有2个硬编码,并且用户名应该是动态的,基于当前通过登录方法使用的电子邮件登录名,但是我无法访问该用户。displayName / email等等

 final Map<String, dynamic> responseData = json.decode(response.body);
      final Product addedProduct = Product(
        id: responseData['name'],
        address: address,
        image: image,
        userEmail: userEmail //the problem
      );

1 个答案:

答案 0 :(得分:0)

您可以使用# create some dummy-data for test mydata = replicate(20, list(matrix(runif(9, 1, 10), ncol = 3))) class(mydata) length(mydata) # to get rowsums for each element of the list we can use lapply in combination with rowsums # and use cbind to attach it to the current list-object. mydata.new = lapply(mydata, function(f) cbind(f, rowSums(f))) # check results mydata.new[1] rowSums(mydata[[1]]) 的{​​{1}}属性。检查API docs或直接进入IDE上的源代码。

email