getList method
Future<List<MyGenericObject> >
getList(
- String keyword,
- RadioListTypes listType, {
- bool forceHttps = false,
- SearchParameters? filter,
- int retryAttempt = 0,
Implementation
Future<List<MyGenericObject>> getList(String keyword, RadioListTypes listType,
{bool forceHttps = false, SearchParameters? filter, int retryAttempt = 0}) async {
String strUrl = "$srvUrl/${listType.name}/$keyword?${filter?.request ?? ""}";
var url = Uri.parse(strUrl);
try {
http.Response response = await http.get(url, headers: {"User-Agent": clientName});
var ds = json.decode(response.body);
List<MyGenericObject> oList = [];
for (var r in ds) {
oList.add(listType.toObject(r));
}
return oList;
} catch (e) {
retryAttempt++;
if (retryAttempt == retryLimit) rethrow;
return getList(keyword, listType, forceHttps: forceHttps, filter: filter, retryAttempt: retryAttempt);
}
}