📅  最后修改于: 2022-03-11 14:57:20.689000             🧑  作者: Mango
Widget UsersList = new StreamBuilder(
stream: Firestore.instance.collection('users').snapshots(),
builder: (context, snapshot) {
return new ListView.builder(
itemCount: (snapshot?.data?.documents?.length ?? 0) + 1,
itemBuilder: (context, index) {
if (index == 0)
return FlatButton(child: Text("Add"));
else
_buildItem(context, snapshot.data.documents[index-1]);
},
);
},
),