我想基于文档ID而不是文档索引访问流构建器。请帮助。
StreamBuilder(
stream: Firestore.instance.collection('users').snapshots(),
builder: (context, snapshot){
if(!snapshot.hasData) return Text('Loading data.....');
return
Center(child: Text(snapshot.data.documents[0]["Name"]),);
您可以获得这样的特定文档,
Firestore.instance
.collection('users')
.document('Name')//your document name
.get()
.then((DocumentSnapshot ds) {
// use ds as a snapshot
});