【发布时间】:2021-03-30 08:29:58
【问题描述】:
有没有一种方法可以将 Firestore 数据(例如“用户信息”)放入 Flutter 中的用户模型类中? 这是我的用户类:
class Users {
final int id;
final String firstName;
final String lastName;
final String emailAddress;
final String imageProfile;
const Users({
this.id,
this.firstName,
this.lastName,
this.emailAddress,
this.imageProfile,
});
}
final Users currentUser = Users(
id: 'GET_DATA_FROM_FIRESTORE'/// firebaseUSer.currentUserUID
firstName: 'GET_DATA_FROM_FIRESTORE',
lastName: 'GET_DATA_FROM_FIRESTORE',
emailAddress: 'GET_DATA_FROM_FIRESTORE',
imageProfile: 'GET_DATA_FROM_FIRESTORE',
);
然后将带有 currentUser.firstName 等的数据传递给其他小部件。
我需要检索到此类中的数据在颤振中创建为 SignuUp 表单并推送到 Firestore 集合
【问题讨论】:
-
您似乎尚未尝试查询 Firestore。从使用documentation 开始,然后一旦您从文档中获取数据,就应该清楚如何将其放入数据类中。
标签: flutter google-cloud-firestore