updateSession method

Future<void> updateSession(
  1. String authCode,
  2. String sessionId,
  3. String sessionOutput,
  4. String status,
)

Implementation

Future<void> updateSession(String authCode, String sessionId,
    String sessionOutput, String status) async {
  CommonUtil().checkConnection().then((value) {
    if (value) {
      _status = Status.loading;
      notifyListeners();
      APICall()
          .updateSession(authCode, sessionId, sessionOutput, status)
          .then((response) {
        log("UPDATE_SESSION_RESPONSE====>${response.statusCode}===${response.body}");
        if (response.statusCode == 200) {
          //print(response.body);
          _updateSessionResponse =
              UpdateSessionResponse.fromJson(json.decode(response.body));
          StaticUtil.updateSessionResponse = _updateSessionResponse;
          _status = Status.successful;
          notifyListeners();
        } else {
          debugPrint('FAILED_UPDATE ::${response.body}');
          _status = Status.failed;
          notifyListeners();
        }
      }).catchError((error, stackTrace) {
        _status = Status.exception;
        debugPrint('ERROR ::: $error==$stackTrace');
        notifyListeners();
      });
    } else {
      _status = Status.noInternet;
      notifyListeners();
    }
  });
}