Here is my code
final _months = [
["January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
];
......
DropdownButtonFormField(
hint: const Text('Select Period'),
items: _months.map((e) {
return DropdownMenuItem(
value: e,
child: Text(e //here is the error showing),
);
}).toList(),
onChanged: (value) {
//do something
},
),
How to solve this , i just changed the months map value to dynamic from dfault, then the error is gone, but when i run the app it showing the another error like "this is not subtype of string"
how to fix this and why is this happening
>Solution :
You have an extra set of [ ] so your _months variable is of type List<List<String>> :
final _months = ["January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];