getlistnpk function
Implementation
Future getlistnpk(String url) async {
try {
List<NpkModel> list = [];
bool logout = true;
http.Response response =
await http.get(Uri.parse('${url}/api/v2/npk_manures'),
);
if((json.decode(response.body))['success']){
List list_npk = (json.decode(response.body))['data'];
for (Map m in list_npk) {
list.add(NpkModel().fromJson(m));
}
return list;
} else {
return logout;
}
} catch (e) {
rethrow;
}
}