I have a list (userData) which has json parsed values; I want to iterate through the list, and strip down a single key/value pair to reduce the list to a set of common values.
The userData list has json parsed data including countries and continents. I want to produce a reduced list of unique continents (and create a dynamic listview with this reduced list). See my side/drawer code below:
drawer: Drawer(
// Add a ListView to the drawer with unique continents
child: ListView.builder(
itemCount: userData == null ? 0 : userData.length,
itemBuilder: (BuildContext context, int index) {
for (var item in userData) {
continents.add(userData[item]['continent']);
}
continents.toSet().toList();
return Container(
width: 130,
alignment: Alignment.center,
child: Text(
"${continents[index]}", //unique continent should be here
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w500,
),
));
},
),
),
Thanks in advance for any assistance!