return Container(
color: Colors.white,
child: StreamBuilder<QuerySnapshot>(
stream: _statusService.getStatus(),
builder: (context, AsyncSnapshot snapshot) {
return !snapshot.hasData
? CircularProgressIndicator()
: ListView.builder(
itemCount: snapshot.data.docs.length,
itemBuilder: (context, index) {
DocumentSnapshot movies = snapshot.data.docs[2];
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 0,
),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 0,
),
child: Text(
"${movies['description']}",
style: TextStyle(
fontSize: 10,
color: Color(0xFF737599),
),
),
),
);
});
}),
);
}
}
有人可以幫我嗎我正在嘗試從firebase呼叫一些資料但它呼叫了3次我沒有找到任何解決方案我正在等待你的答案
uj5u.com熱心網友回復:
我認為您的資料長度為 3,但您只顯示 doc2。對于 doc 3 的長度,資料顯示 3 次。
改變
itemCount: snapshot.data.docs.length,
至
itemCount: 1,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/484124.html
