I have a selectedItems in the list:
List<String> _selectedItems = [];
Then, I want to pass this _selectedItems like this:
Future<void> _filterItem(List<String> _selectedItems) async {
ProgressDialog pr = ProgressDialog(context,
type: ProgressDialogType.Normal, isDismissible: false);
pr.style(message: "Loading...");
await pr.show();
http.post("https://one.com/myapp/php/load_data.php", body: {
"_selectedItems":_selectedItems,
}).then((res) {
if (res.body == "nodata") {
setState(() {
print("No Found");
});
} else {
setState(() {
var extractdata = json.decode(res.body);
tutordata = extractdata["mydata"];
});
}
}).catchError((err) {
print(err);
});
await pr.hide();
}
Passing this _selectedItems throws the error type 'List<String>' is not a subtype of type 'String' in type cast
What should I do?