I have unknown list data fetch from API. Here is my code where I declared random color for the list view.
Widget employeeListBuilder() {
return Scrollbar(
isAlwaysShown: true,
thickness: 6,
radius: const Radius.circular(10),
child: ListView.builder(
itemCount: employee.length,
itemBuilder: (context, i) {
return ListViewWidget(
name: employee[i].name.toString(),
department: employee[i].department.toString(),
color: Colors.primaries[Random().nextInt(Colors.primaries.length)] ,
);
},
),
);
}
