I'm reading a user list from firebase and sending it to ListTile
, but the incoming data comes in alphabetical order. I want this data to come randomly. Does anyone know about this?
FutureBuilder(
future: FirebaseFirestore.instance
.collection('users')
.get(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return const Center(
child: CircularProgressIndicator(),
);
}
return ListView.builder(
itemCount: (snapshot.data! as dynamic).docs.length,
padding: EdgeInsets.zero,
itemBuilder: (context, index) {
return InkWell(
onTap: (){},
child: ListTile(
leading: CircleAvatar(
backgroundImage: NetworkImage(
(snapshot.data! as dynamic).docs[index]['photoUrl'],
),
radius: 30,
),
trailing: ClipOval(
child: Container(
width: 10,
height: 10,
color: Colors.green,
),
),
title: Text(
(snapshot.data! as dynamic).docs[index]['username'], style: TextStyle(color: Colors.white, fontSize: 20),
),
subtitle: Text((snapshot.data! as dynamic).docs[index]['bio'],style: TextStyle(color: Colors.white70,fontSize: 14,)),
),
);
},
);