Reputation: 37
I am making a list of local songs in the SD card and i get them successfully but whenever i try to put them in a ListView.Builder
it doesn't show anything on the screen
here is my code for the ListView.Builder
@override Widget build(BuildContext context) {
return SingleChildScrollView(
physics: ScrollPhysics(),
child: ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: songsData.songsCount,
itemBuilder: (BuildContext context, int index) {
return CustomCard(
songName: songsData.songsList[index].title ??
Center(child: CircularProgressIndicator()),
artistName: songsData.songsList[index].artist ??
Center(child: CircularProgressIndicator()),
);
},
)
);
[![Screenshot of the output][1]][1]}
The function i call to get data already has data in it but the ListView.Builder
doesn't show them
here is my function code for getting songs list from local storage
void getSongsData() async {
songsList = await audioQuery.getSongs();
print(songsList.length);
}
the print statements show that there are data in the list >>
I/flutter (24671): 332
Upvotes: 0
Views: 115
Reputation: 37
The list was used in another class which gets data (SongsData) and to read it's length or it's contents it have to be a static list to be accessible by other classes
Upvotes: 0