receiveResponse method
void
receiveResponse(
- int status_code,
- IncomingMessage response, [
- void onSuccess()?,
- void onFailure()?,
override
Implementation
@override
void receiveResponse(int status_code, IncomingMessage response,
[void Function()? onSuccess, void Function()? onFailure]) {
if (status_code < 200) {
switch (state) {
case TransactionState.TRYING:
case TransactionState.PROCEEDING:
stateChanged(TransactionState.PROCEEDING);
_eventHandlers.emit(
EventOnReceiveResponse(response: response as IncomingResponse?));
break;
default:
break;
}
} else {
switch (state) {
case TransactionState.TRYING:
case TransactionState.PROCEEDING:
stateChanged(TransactionState.COMPLETED);
clearTimeout(F);
if (status_code == 408) {
_eventHandlers.emit(EventOnRequestTimeout());
} else {
_eventHandlers.emit(EventOnReceiveResponse(
response: response as IncomingResponse?));
}
K = setTimeout(() {
timer_K();
}, Timers.TIMER_K);
break;
case TransactionState.COMPLETED:
break;
default:
break;
}
}
}