addResponse method
Logs a response associated with a specific network request.
response
: The network response to be logged.requestId
: The unique identifier of the associated request.
Implementation
void addResponse(InfospectNetworkResponse response, int requestId) {
final int index = _selectCall(requestId);
if (index == -1) {
InfospectUtil.log("Selected call is null");
return;
}
final InfospectNetworkCall selectedCall =
_infospect.networkCallsSubject.value[index];
_infospect.networkCallsSubject.value[index] = selectedCall.copyWith(
loading: false,
response: response,
duration: response.time.millisecondsSinceEpoch -
(selectedCall.request!.time).millisecondsSinceEpoch,
);
_infospect.networkCallsSubject
.add([..._infospect.networkCallsSubject.value]);
_infospect.sendNetworkCalls();
}