autosuggest method
Implementation
Future<List<Map<String, dynamic>>> autosuggest(
String colkey, {
String dv = '',
String combodv = '',
String q = '',
String wf1 = '',
String wf2 = '',
}) async {
List<Map<String, dynamic>> r = [];
if (_code != '') {
await httpSvc.loadAccount(_code!, hostguid: Oph.curPreset.hostguid!);
if (Oph.curPreset.hostguid != null &&
Oph.curPreset.hostguid != '' &&
Oph.curPreset.isLogin!) {
var url = Oph.curPreset.serverURL! +
Oph.curPreset.rootAccountId! +
'/' +
Oph.curPreset.autosuggestURL! +
'?suba=' +
Oph.curPreset.accountId! +
'&code=' +
_code! +
'&colkey=' +
colkey +
'&defaultvalue=' +
dv +
'&q=' +
q +
'&wf1value=' +
wf1 +
'&wf2value=' +
wf2 +
'&parentCode=' +
_code!; //+
//'&hostguid=' +
//Oph.curPreset.hostguid;
//var client = new http.Client();
//var request = new http.Request('GET', Uri.parse(url));
Map<String, String> body = {'hostguid': Oph.curPreset.hostguid!};
/*
//request.bodyFields = body;
try {
var response = await client
.send(request)
.timeout(const Duration(seconds: timeout));
var value = await response.stream.bytesToString();
*/
String value = await httpSvc.getXML(url, body: body);
if (value != '') {
var rsp = jsonDecode(value);
var x = (rsp as Map)["results"] as List;
x.forEach((m) {
r.add(m);
});
//} catch (e) {
//_msg = e.message;
//}
}
}
}
return r;
}