【发布时间】:2021-04-15 05:05:26
【问题描述】:
我想从 Firestore 中获取一组 Timestamp 并将其存储在 Flutter 中的 DateTime 列表中, 我该怎么做?
我想获取这些值并在 Flutter 中将它们打印为 DateTime 类型
我的代码:
return StreamBuilder(
stream: FirebaseFirestore.instance
.collection('medicine')
return StreamBuilder(
stream: FirebaseFirestore.instance
.collection('medicine')
.where('userId', isEqualTo: watcherId)
.snapshots(),
builder: (context, snapshot) {
if (snapshot.data == null) {
return Center(
child: CircularProgressIndicator(),
);
}
final doc = snapshot.data.docs;
return SizedBox(
height: 400.0,
child: ListView.builder(
itemCount: doc.length,
itemBuilder: (ctx, index) {
final docId = doc[index]['docId'];
//below I tried these but it didn't work
// List dayOfMonth= List.from(doc[index]['selectedDates']);
//Timestamp stamp = doc[index]['selectedDates'][index];
//List<Timestamp> stamp = doc[index]['selectedDates'];
return;
}));
});
【问题讨论】:
标签: firebase flutter google-cloud-firestore