updatePumpStatus method
Implementation
Future<void> updatePumpStatus(
String authCode, String pumpId, String status) async {
CommonUtil().checkConnection().then((value) {
if (value) {
_statusUpdatePump = Status.loading;
notifyListeners();
APICall().updatePumpStatus(authCode, pumpId, status).then((response) {
if (response.statusCode == 200) {
//log('updatePumpStatus :: '+response.body);
_updatePumpResponse =
UpdatePumpResponse.fromJson(json.decode(response.body));
_statusUpdatePump = Status.successful;
notifyListeners();
} else {
//print('FAILED ::' + response.body);
_statusUpdatePump = Status.failed;
notifyListeners();
}
}).catchError((error, stackTrace) {
_statusUpdatePump = Status.exception;
//print('ERROR ::: ' + error.toString());
notifyListeners();
});
} else {
_statusUpdatePump = Status.noInternet;
notifyListeners();
}
});
}