我想在更改下拉菜单项时更改列表。.列表是动态的,因此我从下拉菜单更改了选项。.我的列表应更新,仅当调用该API时才会更改列表会被所选的下拉项目更改。整个网址将相同,唯一的更改是该项目。
Future<ParsedDataModel> fetchTicketListData(String queueName) async {
String openURL = "example.com/query=Queue='$queueName'";
// hitting login api
final response3 = await http.get(openURL);
print(response3.body);
if (response3.statusCode == 200 && response3.body.contains("200 Ok"))
{
// parsing plain data to desired model
ParsedDataModel ticketDataModel =
DashBoardViewController().plainDataToParsedModelData(response3.body.trim());
return ticketDataModel;
} else {
throw Exception('There was a problem');
}
}
Future<List<QueueModel>> fetchTicketsList() async {
var dataList = await fetchTicketListData('InternalTools');
if (dataList.isNoResult) {
throw Exception('No result found.');
} else {
List<QueueModel> openTicketList = makeTicketList(dataList);
openTicketsList = openTicketList;
return openTicketsList;
}
}
// function to parse the data into list of (QueueModel)
List<QueueModel> makeTicketList(ParsedDataModel parsedData) {
return
DashBoardViewController().parsedDataToQueueModelData(parsedData.dataList);
}