我想使用 FirebaseFirestore 中的卡片顯示 ListView。另外,我想顯示總共有多少張卡片:
int Length = 0; //?
如何獲取可迭代 .toList() 串列的長度?
Column(
children: snapshot.data!.docs
.map(
(doc) =>
Card(
title: doc["title"],)
.toList(
growable: true,
),
),
),
uj5u.com熱心網友回復:
Column(
...snapshot.data!.docs
.asMap().map((index, value) => MapEntry(index, Card(
title: value["title"],)))
.values.toList(
growable: true,
),
),
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/330568.html
