iam trying to show list of data using StreamBuilderbut when i run this code it give me an error:
i am fallowing this youtube video and i am trying to show data list i need to do this using streambuilder
DatabaseReference starCountRef =
FirebaseDatabase.instance.ref('/Shop/qw1234/Inventory/');
Expanded(child:StreamBuilder(
stream: starCountRef.onValue,
builder: (context,AsyncSnapshot<DatabaseEvent> snapshot){
if(snapshot.hasData){
return ListView.builder(
itemCount: snapshot.data!.snapshot.children.length,
itemBuilder: (context,index){
Map<dynamic, dynamic> map =
snapshot.data!.snapshot.value as dynamic;
List<dynamic> list = [];
list.clear();
list = map.values.toList();
return ListTile(
title: Text('data'),
);
});
}else{
return Text("no");
}
},
)
)