addResponse method
Add response to existing alice http call
Implementation
void addResponse(AliceHttpResponse? response, int? requestId) {
assert(response != null, "response can't be null");
assert(requestId != null, "requestId can't be null");
if (response == null || requestId == null) {
return;
}
AliceHttpCall? selectedCall = _selectCall(requestId);
if (selectedCall == null) {
print("Selected call is null");
return;
}
selectedCall.loading = false;
selectedCall.response = response;
if (selectedCall.request?.time.millisecondsSinceEpoch != null) {
selectedCall.duration = response.time.millisecondsSinceEpoch -
selectedCall.request!.time.millisecondsSinceEpoch;
}
callsSubject.add([...callsSubject.value]);
}