'flutter firebase StreamBuilder iteams repeating
StreamBuilder<QuerySnapshot>(
stream: chatRef
.where('ids', arrayContainsAny: [FirebaseAuth.instance.currentUser!.uid])
.orderBy('lastTime', descending: true)
.snapshots(),
builder: (context,snapshot ){
if (snapshot.hasData) {
final mess = snapshot.data!.docs;
final List<ChatList> messages= mess.map((e) => ChatList.fom( e , FirebaseAuth.instance.currentUser!.uid)).toList() ;
// }
return Column(
children: [
Expanded(
child: ListView(
// controller: scr,
children: messages,
),
),
],
);
} else {
return Column(
children: [
Expanded(
child: ListView(
children: [
Center(
child: SpinKitCubeGrid(
color: Colors.green,
),
),
],
),
),
],
);
}
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
