downloadAddressDetail method
Future<List>
downloadAddressDetail(
- dynamic param,
- dynamic context
)
Implementation
Future<List> downloadAddressDetail(param, context) async {
myLogAll('downloadAddressDetail');
List result = [];
try {
dynamic myUrl = MyConfig.URLAddress.name + param;
http.Response response = (await httpClient.get(Uri.parse(myUrl)));
if (response.statusCode == 200) {
Utf8Decoder decode = const Utf8Decoder();
Map data = getMap(getJsonDecode(decode.convert(response.bodyBytes)));
if (data.isEmpty) {
return result;
}
List itemList = data["Items"];
if (itemList.isEmpty) {
return result;
}
for (int i = 0; i < itemList.length; i++) {
Map oneItem = getMap(itemList[i]);
result.add(oneItem);
}
} else {
showMsg(context, 'Error code: ${response.statusCode}', null);
}
} catch (ex) {
showMsg(context, ex, null);
}
//result = getArrayMatch(result, param);
return result;
//print('======== filePath is $filePath');
}