onResponse method
Called when the response is about to be resolved.
Implementation
@override
void onResponse(Response response, ResponseInterceptorHandler handler) {
if (showLogResponse) {
String loggerText = "API-RESPONSE";
loggerText += "\nAPI PATH: ${response.requestOptions.baseUrl}${response.requestOptions.path}";
loggerText += "\nMETHOD: ${response.requestOptions.method}";
loggerText += "\nREQUEST";
loggerText += "\nHEADER: ${response.requestOptions.headers}";
if (response.requestOptions.data != null) {
loggerText += "\nREQUEST DATA: ${response.requestOptions.data}";
}
loggerText += "\nRESPONSE";
loggerText += "\nHTTP STATUS CODE: ${response.statusCode}";
loggerText += "\nRESPONSE DATA: ${response.data}";
logger.i(loggerText);
}
super.onResponse(response, handler);
}