alcoholicFilter function
List the alcoholic filter.
Returns List of String.
Implementation
Future<List<String>> alcoholicFilter() async {
try {
var response = await _getRequest("list.php?a=list");
if (response.length == 0) {
throw "no results found";
}
var json = jsonDecode(response);
if (json["drinks"] == null || json["drinks"].length == 0) {
throw "no results found";
}
List<String> list = [];
for (var i in json["drinks"]) {
list.add(i["strAlcoholic"]);
}
return list;
} catch(ex) {
throw new CocktailDBException(ex.toString());
}
}